mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-33656 Properly align f-string nodes joined using backslashes
This commit is contained in:
@@ -295,7 +295,7 @@ public class PyBlock implements ASTBlock {
|
||||
}
|
||||
}
|
||||
else if (parentType == PyElementTypes.STRING_LITERAL_EXPRESSION) {
|
||||
if (PyTokenTypes.STRING_NODES.contains(childType)) {
|
||||
if (PyTokenTypes.STRING_NODES.contains(childType) || childType == PyElementTypes.FSTRING_NODE) {
|
||||
childAlignment = getAlignmentForChildren();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
string_literal = f'foo' \
|
||||
f'bar'
|
||||
@@ -0,0 +1,2 @@
|
||||
string_literal = f'foo' \
|
||||
f'bar'
|
||||
@@ -126,13 +126,13 @@ public class PyEditingTest extends PyTestCase {
|
||||
|
||||
public void testEnterInFStringTextPart() {
|
||||
doTestEnter("f'foo<caret>bar'", "f'foo' \\\n" +
|
||||
" f'bar'");
|
||||
"f'bar'");
|
||||
}
|
||||
|
||||
// PY-31984
|
||||
public void testEnterInFStringRightBeforeFragment() {
|
||||
doTestEnter("f'foo<caret>{42}bar'", "f'foo' \\\n" +
|
||||
" f'{42}bar'");
|
||||
"f'{42}bar'");
|
||||
}
|
||||
|
||||
// PY-32918
|
||||
|
||||
@@ -931,6 +931,11 @@ public class PyFormatterTest extends PyTestCase {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
|
||||
}
|
||||
|
||||
// PY-33656
|
||||
public void testBackslashGluedFStringNodesAlignment() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-31991
|
||||
public void testSpacesAroundFStringFragmentExpressionStripped() {
|
||||
runWithLanguageLevel(LanguageLevel.PYTHON36, this::doTest);
|
||||
|
||||
Reference in New Issue
Block a user