mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
[java, formatter] separate setting for space around = in annotations IDEA-168042
GitOrigin-RevId: a82e40692a706ac35b3b2c6ef12edfef8f068d40
This commit is contained in:
committed by
intellij-monorepo-bot
parent
eadad3036f
commit
fd1ca7caae
@@ -15,6 +15,7 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiFileFactory;
|
||||
import com.intellij.psi.codeStyle.*;
|
||||
import com.intellij.psi.codeStyle.presentation.CodeStyleSettingPresentation;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.LocalTimeCounter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -79,6 +80,8 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
consumer.showAllStandardOptions();
|
||||
consumer.showCustomOption(JavaCodeStyleSettings.class, "SPACES_WITHIN_ANGLE_BRACKETS",
|
||||
JavaBundle.message("code.style.settings.angle.spacing.brackets"), getInstance().SPACES_WITHIN);
|
||||
consumer.showCustomOption(JavaCodeStyleSettings.class, "SPACE_AROUND_ANNOTATION_EQ",
|
||||
JavaBundle.message("checkbox.spaces.around.annotation.eq"), getInstance().SPACES_OTHER);
|
||||
consumer.showCustomOption(JavaCodeStyleSettings.class, "SPACE_WITHIN_RECORD_HEADER",
|
||||
JavaBundle.message("checkbox.spaces.record.header"), getInstance().SPACES_WITHIN);
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.intellij.psi.codeStyle;
|
||||
|
||||
import com.intellij.application.options.CodeStyle;
|
||||
import com.intellij.configurationStore.Property;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
@@ -114,6 +113,8 @@ public class JavaCodeStyleSettings extends CustomCodeStyleSettings implements Im
|
||||
public boolean NEW_LINE_AFTER_LPAREN_IN_ANNOTATION = false;
|
||||
public boolean RPAREN_ON_NEW_LINE_IN_ANNOTATION = false;
|
||||
|
||||
public boolean SPACE_AROUND_ANNOTATION_EQ = true;
|
||||
|
||||
public boolean ALIGN_MULTILINE_TEXT_BLOCKS = false;
|
||||
|
||||
public int BLANK_LINES_AROUND_INITIALIZER = 1;
|
||||
|
||||
@@ -1778,7 +1778,7 @@ public final class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
@Override
|
||||
public void visitNameValuePair(PsiNameValuePair pair) {
|
||||
if (myRole1 == ChildRole.OPERATION_SIGN || myRole2 == ChildRole.OPERATION_SIGN) {
|
||||
createSpaceInCode(mySettings.SPACE_AROUND_ASSIGNMENT_OPERATORS);
|
||||
createSpaceInCode(myJavaSettings.SPACE_AROUND_ANNOTATION_EQ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@
|
||||
"space_within_empty_method_call_parentheses": false,
|
||||
"space_within_empty_method_parentheses": false,
|
||||
"spaces_around_additive_operators": true,
|
||||
"spaces_around_annotation_eq": true,
|
||||
"spaces_around_assignment_operators": true,
|
||||
"spaces_around_bitwise_operators": true,
|
||||
"spaces_around_equality_operators": true,
|
||||
|
||||
@@ -222,7 +222,7 @@ public class AnnotationFormatterTest extends JavaFormatterTestCase {
|
||||
}
|
||||
|
||||
public void testSpaces3() {
|
||||
getSettings(JavaLanguage.INSTANCE).SPACE_AROUND_ASSIGNMENT_OPERATORS = false;
|
||||
getCustomJavaSettings().SPACE_AROUND_ANNOTATION_EQ = false;
|
||||
doTextTest("public interface PsiClass{\n" +
|
||||
" @Nullable(documentation = \"parameter1 value\", doc2=\"parameter2 value\")\n" +
|
||||
" String getQualifiedName();\n" +
|
||||
@@ -234,7 +234,7 @@ public class AnnotationFormatterTest extends JavaFormatterTestCase {
|
||||
}
|
||||
|
||||
public void testSpaces4() {
|
||||
getSettings(JavaLanguage.INSTANCE).SPACE_AROUND_ASSIGNMENT_OPERATORS = true;
|
||||
getCustomJavaSettings().SPACE_AROUND_ANNOTATION_EQ = true;
|
||||
|
||||
doTextTest("public interface PsiClass{\n" +
|
||||
" @Nullable(documentation = \"parameter1 value\", doc2=\"parameter2 value\")\n" +
|
||||
|
||||
@@ -61,6 +61,7 @@ checkbox.after.parameter.descriptions=After parameter descriptions
|
||||
checkbox.after.return.tag=After return tag
|
||||
checkbox.align.parameter.descriptions=Align parameter descriptions
|
||||
checkbox.align.thrown.exception.descriptions=Align thrown exception descriptions
|
||||
checkbox.spaces.around.annotation.eq=Around '=' in annotation value pair
|
||||
checkbox.annotate.local.variables=Annotate local variables
|
||||
checkbox.collapse.annotations=Annotations
|
||||
checkbox.collapse.anonymous.classes=Anonymous classes
|
||||
|
||||
Reference in New Issue
Block a user