don't indent comments following a statement list (PY-9542)

This commit is contained in:
Dmitry Jemerov
2013-11-12 15:12:35 +01:00
parent 330dfc0ffd
commit 2d074933c3
4 changed files with 16 additions and 1 deletions
@@ -241,7 +241,8 @@ public class PyBlock implements ASTBlock {
}
}
if (isAfterStatementList(child) && !hasLineBreaksBefore(child, 2)) { // maybe enter was pressed and cut us from a previous (nested) statement list
if (isAfterStatementList(child) && !hasLineBreaksBefore(child, 2) && child.getElementType() != PyTokenTypes.END_OF_LINE_COMMENT) {
// maybe enter was pressed and cut us from a previous (nested) statement list
childIndent = Indent.getNormalIndent();
}
@@ -0,0 +1,5 @@
def test():
if bar:
foo()
# comment
foobar()
@@ -0,0 +1,5 @@
def test():
if bar:
foo()
# comment
foobar()
@@ -350,6 +350,10 @@ public class PyFormatterTest extends PyTestCase {
doTest();
}
public void testCommentAfterBlock() { // PY-9542
doTest();
}
private void doTest() {
doTest(false);
}