mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-61395 Groovy: incorrect anonymous classes formatting
This commit is contained in:
@@ -42,6 +42,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrCodeBlock;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrBinaryExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrConditionalExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrAnonymousClassDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrExtendsClause;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -152,7 +153,7 @@ public class GroovyBlockGenerator implements GroovyElementTypes {
|
||||
ASTNode prevChildNode = null;
|
||||
for (ASTNode childNode : visibleChildren(node)) {
|
||||
final Indent indent = GroovyIndentProcessor.getChildIndent(block, prevChildNode, childNode);
|
||||
subBlocks.add(new GroovyBlock(childNode, myAlignment, indent, myWrap, mySettings, block.myInnerAlignments));
|
||||
subBlocks.add(new GroovyBlock(childNode, blockPsi instanceof GrAnonymousClassDefinition ? null : myAlignment, indent, myWrap, mySettings, block.myInnerAlignments));
|
||||
prevChildNode = childNode;
|
||||
}
|
||||
return subBlocks;
|
||||
|
||||
@@ -129,6 +129,11 @@ public class FormatterTest extends GroovyFormatterTestCase {
|
||||
}
|
||||
public void testCaseInSwitchIndented() throws Throwable { doTest(); }
|
||||
|
||||
public void testAnonymousInCall() throws Throwable {
|
||||
myTempSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testClosureParametersAligned() throws Throwable {
|
||||
myTempSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
|
||||
doTest();
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
bar(new Runnable() {
|
||||
void run() {
|
||||
|
||||
}
|
||||
})
|
||||
-----
|
||||
bar(new Runnable() {
|
||||
void run() {
|
||||
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user