don't indent closing paren of tuple (PY-7946)

This commit is contained in:
Dmitry Jemerov
2012-12-13 17:04:00 +01:00
parent dbe5942f26
commit ff9b2b7aa4
5 changed files with 19 additions and 4 deletions
@@ -192,9 +192,13 @@ public class PyBlock implements ASTBlock {
childIndent = Indent.getNormalIndent();
}
}
else if ((parentType == PyElementTypes.PARENTHESIZED_EXPRESSION || parentType == PyElementTypes.GENERATOR_EXPRESSION) &&
hasLineBreaksBefore(child, 1)) {
childIndent = Indent.getNormalIndent();
else if ((parentType == PyElementTypes.PARENTHESIZED_EXPRESSION || parentType == PyElementTypes.GENERATOR_EXPRESSION)) {
if (childType == PyTokenTypes.RPAR || !hasLineBreaksBefore(child, 1)) {
childIndent = Indent.getNoneIndent();
}
else {
childIndent = Indent.getNormalIndent();
}
}
if (isAfterStatementList(child) && !hasLineBreaksBefore(child, 2)) { // maybe enter was pressed and cut us from a previous (nested) statement list
@@ -0,0 +1,4 @@
tuple = (
'value',
'value',
)
@@ -0,0 +1,4 @@
tuple = (
'value',
'value',
)
@@ -4,4 +4,4 @@ if True:
'\n'
' Let\'s go.\n'
' And they went out.'
)
)
@@ -199,7 +199,10 @@ public class PyFormatterTest extends PyTestCase {
public void testSpaceWithinBraces() { // PY-8069
settings().getCustomSettings(PyCodeStyleSettings.class).SPACE_WITHIN_BRACES = true;
doTest();
}
public void testTupleClosingParen() { // PY-7946
doTest();
}
public void testPsiFormatting() { // IDEA-69724