mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Java. Code Formatting] Add support to configure spaces for simple nonempty blocks when the "Spaces within blocks" is disabled
IDEA-270369 GitOrigin-RevId: 19283bcf734658323659abe7f14e5c38fdc9fec3
This commit is contained in:
committed by
intellij-monorepo-bot
parent
db12d5db2d
commit
bb9759a556
@@ -131,6 +131,7 @@ public class JavaCodeStyleSettings extends CustomCodeStyleSettings implements Im
|
||||
public boolean SPACE_BEFORE_COLON_IN_FOREACH = true;
|
||||
public boolean SPACE_INSIDE_ONE_LINE_ENUM_BRACES = false;
|
||||
|
||||
public boolean SPACES_INSIDE_BLOCK_BRACES_WHEN_BODY_IS_PRESENTED = false;
|
||||
public boolean NEW_LINE_WHEN_BODY_IS_PRESENTED = false;
|
||||
|
||||
public boolean useFqNamesInJavadocAlways() {
|
||||
|
||||
@@ -97,6 +97,9 @@ public final class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeSty
|
||||
consumer.showCustomOption(JavaCodeStyleSettings.class, "SPACE_INSIDE_ONE_LINE_ENUM_BRACES", JavaBundle.message(
|
||||
"checkbox.spaces.inside.one.line.enum"), groupName);
|
||||
|
||||
consumer.showCustomOption(JavaCodeStyleSettings.class, "SPACES_INSIDE_BLOCK_BRACES_WHEN_BODY_IS_PRESENTED",
|
||||
JavaBundle.message("checkbox.spaces.inside.block.braces.when.body.is.presented"), groupName);
|
||||
|
||||
consumer.showCustomOption(JavaCodeStyleSettings.class, "SPACE_BEFORE_DECONSTRUCTION_LIST", JavaBundle.message(
|
||||
"checkbox.spaces.before.deconstruction.list"), getInstance().SPACES_BEFORE_PARENTHESES);
|
||||
}
|
||||
|
||||
@@ -922,7 +922,10 @@ public final class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
}
|
||||
}
|
||||
else if (myRole1 == ChildRole.LBRACE) {
|
||||
int spacesAfterLBrace = mySettings.SPACE_WITHIN_BRACES ? 1 : 0;
|
||||
int spacesAfterLBrace;
|
||||
if (myRole2 == ChildRole.RBRACE) spacesAfterLBrace = mySettings.SPACE_WITHIN_BRACES ? 1 : 0;
|
||||
else spacesAfterLBrace = mySettings.SPACE_WITHIN_BRACES || myJavaSettings.SPACES_INSIDE_BLOCK_BRACES_WHEN_BODY_IS_PRESENTED ? 1 : 0;
|
||||
|
||||
if (!keepInOneLine) {
|
||||
int blankLines = 1;
|
||||
if (myParent != null) {
|
||||
@@ -943,7 +946,7 @@ public final class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
}
|
||||
}
|
||||
else if (myRole2 == ChildRole.RBRACE) {
|
||||
int spacesBeforeRBrace = mySettings.SPACE_WITHIN_BRACES ? 1 : 0;
|
||||
int spacesBeforeRBrace = mySettings.SPACE_WITHIN_BRACES || myJavaSettings.SPACES_INSIDE_BLOCK_BRACES_WHEN_BODY_IS_PRESENTED ? 1 : 0;
|
||||
if (!keepInOneLine) {
|
||||
myResult = Spacing.createSpacing(
|
||||
spacesBeforeRBrace, spacesBeforeRBrace, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_BEFORE_RBRACE);
|
||||
|
||||
@@ -103,6 +103,7 @@ checkbox.prefer.longer.names=Prefer longer names
|
||||
checkbox.preserve.line.feeds=Preserve line feeds
|
||||
checkbox.spaces.record.header=Record header
|
||||
checkbox.spaces.within.deconstruction.list=Deconstruction list
|
||||
checkbox.spaces.inside.block.braces.when.body.is.presented=Inside block braces when body is presented
|
||||
checkbox.spaces.before.colon.in.foreach=Before colon in foreach
|
||||
checkbox.spaces.before.deconstruction.list=Deconstruction list
|
||||
checkbox.spaces.inside.one.line.enum=Inside one line enum braces
|
||||
|
||||
Reference in New Issue
Block a user