diff --git a/python/src/com/jetbrains/python/formatter/PyBlock.java b/python/src/com/jetbrains/python/formatter/PyBlock.java index 2b03588bd7b4..dd61926a9bbc 100644 --- a/python/src/com/jetbrains/python/formatter/PyBlock.java +++ b/python/src/com/jetbrains/python/formatter/PyBlock.java @@ -230,6 +230,9 @@ public class PyBlock implements ASTBlock { PyArgumentList argList = (PyArgumentList) _node.getPsi(); return argList != null && argList.getArguments().length > 1; } + if (child.getElementType() == PyTokenTypes.COMMA) { + return false; + } return true; } diff --git a/python/testSrc/com/jetbrains/python/PyIndentTest.java b/python/testSrc/com/jetbrains/python/PyIndentTest.java index 40f924bdabb7..6149e2775e8f 100644 --- a/python/testSrc/com/jetbrains/python/PyIndentTest.java +++ b/python/testSrc/com/jetbrains/python/PyIndentTest.java @@ -271,6 +271,20 @@ public class PyIndentTest extends PyLightFixtureTestCase { ""); } + public void testNestedLists() { // PY-4034 + doTest("mat = [\n" + + " [1, 2, 3, 4, 4.5],\n" + + " [5, 6, 7, 8],\n" + + " [9, 10, 11, 12],\n" + + "]", + "mat = [\n" + + " [1, 2, 3, 4, 4.5],\n" + + " [5, 6, 7, 8],\n" + + " [9, 10, 11, 12],\n" + + " \n" + + "]"); + } + /* TODO: formatter core problem? public void testAlignListBeforeEquals() throws Exception {