mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
align method parentheses
This commit is contained in:
@@ -62,6 +62,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrM
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameterList;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrExtendsClause;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinitionBody;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.PsiUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -243,6 +244,19 @@ public class GroovyBlockGenerator implements GroovyElementTypes {
|
||||
return generateSubBlockForCodeBlocks(classLevel, visibleChildren(myNode));
|
||||
}
|
||||
|
||||
if (blockPsi instanceof GrMethod) {
|
||||
final AlignmentProvider.Aligner parenthesesAligner = mySettings.ALIGN_MULTILINE_METHOD_BRACKETS ? myAlignmentProvider.createAligner(false) : null;
|
||||
|
||||
final ArrayList<Block> subBlocks = new ArrayList<Block>();
|
||||
for (ASTNode childNode : visibleChildren(myNode)) {
|
||||
final Indent indent = new GroovyIndentProcessor().getChildIndent(myBlock, childNode);
|
||||
if (childNode.getElementType() == mLPAREN && parenthesesAligner != null) parenthesesAligner.append(childNode.getPsi());
|
||||
if (childNode.getElementType() == mRPAREN && parenthesesAligner != null) parenthesesAligner.append(childNode.getPsi());
|
||||
subBlocks.add(new GroovyBlock(childNode, indent, myWrap, mySettings, myGroovySettings, myAlignmentProvider));
|
||||
}
|
||||
return subBlocks;
|
||||
}
|
||||
|
||||
// For other cases
|
||||
final ArrayList<Block> subBlocks = new ArrayList<Block>();
|
||||
for (ASTNode childNode : visibleChildren(myNode)) {
|
||||
|
||||
@@ -587,6 +587,19 @@ foo( )
|
||||
''')
|
||||
}
|
||||
|
||||
void testAlignMethodParentheses() {
|
||||
groovySettings.ALIGN_MULTILINE_METHOD_BRACKETS = true
|
||||
checkFormatting('''\
|
||||
def foooo(
|
||||
String s
|
||||
) {}
|
||||
''', '''\
|
||||
def foooo(
|
||||
String s
|
||||
) {}
|
||||
''')
|
||||
}
|
||||
|
||||
private void doGeeseTest() {
|
||||
GroovyCodeStyleSettings customSettings = myTempSettings.getCustomSettings(GroovyCodeStyleSettings.class);
|
||||
boolean oldvalue = customSettings.USE_FLYING_GEESE_BRACES;
|
||||
|
||||
Reference in New Issue
Block a user