mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
use continuation indent for parameters of call in expression part of control statement (PY-8577)
This commit is contained in:
@@ -162,7 +162,7 @@ public class PyBlock implements ASTBlock {
|
||||
childIndent = Indent.getNoneIndent();
|
||||
}
|
||||
else {
|
||||
childIndent = parentType == PyElementTypes.PARAMETER_LIST
|
||||
childIndent = parentType == PyElementTypes.PARAMETER_LIST || isCallInControlStatement()
|
||||
? Indent.getContinuationIndent()
|
||||
: Indent.getNormalIndent();
|
||||
}
|
||||
@@ -214,6 +214,10 @@ public class PyBlock implements ASTBlock {
|
||||
return new PyBlock(this, child, childAlignment, childIndent, wrap, myContext);
|
||||
}
|
||||
|
||||
private boolean isCallInControlStatement() {
|
||||
return PsiTreeUtil.getParentOfType(_node.getPsi(), PyStatementPart.class, false, PyStatementList.class) != null;
|
||||
}
|
||||
|
||||
private boolean isSliceOperand(ASTNode child) {
|
||||
if (_node.getPsi() instanceof PySliceExpression) {
|
||||
PySliceExpression sliceExpression = (PySliceExpression)_node.getPsi();
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
for item in really_long_name_of_the_function_with_a_lot_of_patams(
|
||||
param1, param2, param3):
|
||||
pass
|
||||
@@ -0,0 +1,3 @@
|
||||
for item in really_long_name_of_the_function_with_a_lot_of_patams(
|
||||
param1, param2, param3):
|
||||
pass
|
||||
@@ -255,6 +255,10 @@ public class PyFormatterTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testContinuationIndentForCallInStatementPart() { // PY-8577
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user