mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
one more case of dedenting after control flow break (PY-289)
This commit is contained in:
@@ -385,6 +385,9 @@ public class PyBlock implements ASTBlock {
|
||||
while (lastChild != null) {
|
||||
IElementType last_type = lastChild.getElementType();
|
||||
if ( last_type == PyElementTypes.STATEMENT_LIST && hasLineBreakBefore(lastChild)) {
|
||||
if (dedentAfterLastStatement((PyStatementList)lastChild.getPsi())) {
|
||||
break;
|
||||
}
|
||||
statementListsBelow++;
|
||||
}
|
||||
else if (statementListsBelow > 0 && lastChild.getPsi() instanceof PsiErrorElement) {
|
||||
|
||||
@@ -167,6 +167,19 @@ public class PyIndentTest extends PyLightFixtureTestCase {
|
||||
" <caret>");
|
||||
}
|
||||
|
||||
public void testUnindentAfterReturnNotLast() { // PY-289
|
||||
doTest("def foo():\n" +
|
||||
" if True:\n" +
|
||||
" return<caret>\n" +
|
||||
"def bar(): pass",
|
||||
"def foo():\n" +
|
||||
" if True:\n" +
|
||||
" return\n" +
|
||||
" <caret>\n" +
|
||||
"def bar(): pass"
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: formatter core problem?
|
||||
public void testAlignListBeforeEquals() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user