diff --git a/python/src/com/jetbrains/python/formatter/PyBlock.java b/python/src/com/jetbrains/python/formatter/PyBlock.java index 4898bca87aca..d2a8b9d61b30 100644 --- a/python/src/com/jetbrains/python/formatter/PyBlock.java +++ b/python/src/com/jetbrains/python/formatter/PyBlock.java @@ -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(); + } } } } diff --git a/python/testSrc/com/jetbrains/python/PyFormatterTest.java b/python/testSrc/com/jetbrains/python/PyFormatterTest.java index f6a5359472d4..167e70faae9d 100644 --- a/python/testSrc/com/jetbrains/python/PyFormatterTest.java +++ b/python/testSrc/com/jetbrains/python/PyFormatterTest.java @@ -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();