From 6a51d99f8bb56bac0ede5da23bfad32e4d5812c0 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Tue, 5 Jul 2011 15:26:53 +0200 Subject: [PATCH] commas don't need to be aligned (PY-4034) --- .../com/jetbrains/python/formatter/PyBlock.java | 3 +++ .../testSrc/com/jetbrains/python/PyIndentTest.java | 14 ++++++++++++++ 2 files changed, 17 insertions(+) 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 {