mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[Java. Code Formatting] Replace regular indent to smart indent for the method declaration parameters to behave similar to the method call arguments
IDEA-165216 GitOrigin-RevId: 2c3d251d827c947ae3fdea9dddfce660775a01b1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
36b4641db7
commit
0aee70350c
@@ -949,7 +949,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
|
||||
Indent externalIndent = Indent.getNoneIndent();
|
||||
Indent internalIndent = Indent.getContinuationWithoutFirstIndent(false);
|
||||
|
||||
if (isInsideMethodCallParenthesis(child)) {
|
||||
if (isInsideMethodCallParenthesis(child) || isInsideMethodDeclarationParenthesis(child)) {
|
||||
internalIndent = Indent.getSmartIndent(Indent.Type.CONTINUATION);
|
||||
}
|
||||
|
||||
@@ -1021,6 +1021,13 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isInsideMethodDeclarationParenthesis(@NotNull ASTNode child) {
|
||||
ASTNode parent = child.getTreeParent();
|
||||
if (parent == null || parent.getElementType() != JavaElementType.PARAMETER_LIST) return false;
|
||||
ASTNode grandParent = parent.getTreeParent();
|
||||
return grandParent != null && grandParent.getElementType() == JavaElementType.METHOD;
|
||||
}
|
||||
|
||||
private static boolean canUseAnonymousClassAlignment(@NotNull ASTNode child) {
|
||||
// The general idea is to handle situations like below:
|
||||
// test(new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user