mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
indent, rather than align, child expression of subscription expression (PY-8572)
This commit is contained in:
@@ -200,6 +200,12 @@ public class PyBlock implements ASTBlock {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
}
|
||||
else if (parentType == PyElementTypes.SUBSCRIPTION_EXPRESSION) {
|
||||
PyExpression indexExpression = ((PySubscriptionExpression)_node.getPsi()).getIndexExpression();
|
||||
if (indexExpression != null && child == indexExpression.getNode()) {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
}
|
||||
|
||||
if (isAfterStatementList(child) && !hasLineBreaksBefore(child, 2)) { // maybe enter was pressed and cut us from a previous (nested) statement list
|
||||
childIndent = Indent.getNormalIndent();
|
||||
@@ -279,6 +285,9 @@ public class PyBlock implements ASTBlock {
|
||||
if (_node.getElementType() == PyElementTypes.PARAMETER_LIST) {
|
||||
return myContext.getSettings().ALIGN_MULTILINE_PARAMETERS;
|
||||
}
|
||||
if (_node.getElementType() == PyElementTypes.SUBSCRIPTION_EXPRESSION) {
|
||||
return false;
|
||||
}
|
||||
if (child.getElementType() == PyTokenTypes.COMMA) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
if True:
|
||||
if False:
|
||||
if True:
|
||||
returnData['error_text'] = "User with " + email_address + " email address is already part of " + company.name
|
||||
@@ -0,0 +1,5 @@
|
||||
if True:
|
||||
if False:
|
||||
if True:
|
||||
returnData[
|
||||
'error_text'] = "User with " + email_address + " email address is already part of " + company.name
|
||||
@@ -248,7 +248,13 @@ public class PyFormatterTest extends PyTestCase {
|
||||
settings().WRAP_LONG_LINES = false;
|
||||
doTest();
|
||||
}
|
||||
|
||||
|
||||
public void testIndentInSlice() { // PY-8572
|
||||
settings().RIGHT_MARGIN = 120;
|
||||
settings().WRAP_LONG_LINES = false;
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile("formatter/" + getTestName(true) + ".py");
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user