mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-58510 code style/spaces within brackets does not apply to new array creation with a length specified
'Space within brackets' is processed for array initialisation brackets now
This commit is contained in:
@@ -185,6 +185,9 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
else if (myRole2 == ChildRole.ARGUMENT_LIST) {
|
||||
createSpaceInCode(mySettings.SPACE_BEFORE_METHOD_CALL_PARENTHESES);
|
||||
}
|
||||
else if (myRole1 == ChildRole.LBRACKET || myRole2 == ChildRole.RBRACKET) {
|
||||
createSpaceInCode(mySettings.SPACE_WITHIN_BRACKETS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void visitArrayInitializerExpression(PsiArrayInitializerExpression expression) {
|
||||
|
||||
@@ -163,4 +163,15 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
|
||||
" }\n" +
|
||||
"}");
|
||||
}
|
||||
|
||||
public void testSpaceWithArrayBrackets() throws Exception {
|
||||
// Inspired by IDEA-58510
|
||||
getSettings().SPACE_WITHIN_BRACKETS = true;
|
||||
doMethodTest(
|
||||
"int[] i = new int[1]\n" +
|
||||
"i[0] = 1;",
|
||||
"int[] i = new int[ 1 ]\n" +
|
||||
"i[ 0 ] = 1;"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user