mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
better formatting for generator expressions (PY-6219)
This commit is contained in:
@@ -183,7 +183,8 @@ public class PyBlock implements ASTBlock {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
}
|
||||
else if (parentType == PyElementTypes.PARENTHESIZED_EXPRESSION && hasLineBreaksBefore(child, 1)) {
|
||||
else if ((parentType == PyElementTypes.PARENTHESIZED_EXPRESSION || parentType == PyElementTypes.GENERATOR_EXPRESSION) &&
|
||||
hasLineBreaksBefore(child, 1)) {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
def dbl():
|
||||
return (
|
||||
(a, a) for a in [])
|
||||
@@ -0,0 +1,3 @@
|
||||
def dbl():
|
||||
return (
|
||||
(a, a) for a in [])
|
||||
@@ -144,6 +144,10 @@ public class PyFormatterTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testIndentInGenerator() { // PY-6219
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testPsiFormatting() { // IDEA-69724
|
||||
String initial =
|
||||
"def method_name(\n" +
|
||||
|
||||
Reference in New Issue
Block a user