mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-10182 Use same indentation level instead of alignment for closing parenthesis in "from" imports
This way the position of the parenthesis doesn't depend on the option ALIGN_MULTIPLE_IMPORTS, because if it's disabled and there is hanging indent, import elements inside parentheses don't have any alignment to share.
This commit is contained in:
@@ -283,9 +283,12 @@ public class PyBlock implements ASTBlock {
|
||||
}
|
||||
if (childType == PyTokenTypes.RPAR) {
|
||||
childIndent = Indent.getNoneIndent();
|
||||
if (!hasHangingIndent(myNode.getPsi()) || settings.HANG_CLOSING_BRACKETS) {
|
||||
if (!hasHangingIndent(myNode.getPsi())) {
|
||||
childAlignment = getAlignmentForChildren();
|
||||
}
|
||||
else if (settings.HANG_CLOSING_BRACKETS) {
|
||||
childIndent = Indent.getNormalIndent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -676,6 +676,8 @@ public class PyFormatterTest extends PyTestCase {
|
||||
|
||||
// PY-10182
|
||||
public void testHangClosingParenthesisInFromImport() {
|
||||
// Shouldn't affect the result
|
||||
getPythonCodeStyleSettings().ALIGN_MULTILINE_IMPORTS = false;
|
||||
getPythonCodeStyleSettings().HANG_CLOSING_BRACKETS = true;
|
||||
doTest();
|
||||
}
|
||||
@@ -692,7 +694,7 @@ public class PyFormatterTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-10182
|
||||
// PY-10182
|
||||
public void testHangClosingParenthesisInListLiteral() {
|
||||
getPythonCodeStyleSettings().HANG_CLOSING_BRACKETS = true;
|
||||
doTest();
|
||||
|
||||
Reference in New Issue
Block a user