IDEA-74354 Multiline parameteres list indentation inconsistency

This commit is contained in:
peter
2011-09-22 17:37:22 +02:00
parent 897624263f
commit 7ad766e127
2 changed files with 23 additions and 2 deletions
@@ -23,6 +23,7 @@ import com.intellij.formatting.Wrap;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -275,8 +276,10 @@ public class GroovyBlockGenerator implements GroovyElementTypes {
}
private static boolean isKeyword(ASTNode node) {
return node != null && (TokenSets.KEYWORDS.contains(node.getElementType()) ||
TokenSets.BRACES.contains(node.getElementType()));
if (node == null) return false;
return TokenSets.KEYWORDS.contains(node.getElementType()) ||
TokenSets.BRACES.contains(node.getElementType()) && !PlatformPatterns.psiElement().withText(")").withParent(GrArgumentList.class).afterLeaf(",").accepts(node.getPsi());
}
@@ -203,5 +203,23 @@ def c = { a ->
"""
}
public void testEnterWithAlignedParameters() {
myTempSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true
doTest """foo(2,<caret>)
""", """foo(2,
<caret>)
"""
}
public void testEnterWithAlignedParameters2() {
myTempSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true
doTest """foo(2,<caret>
""", """foo(2,
<caret>
"""
}
}