mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CIDR Formatter: more spaces
This commit is contained in:
@@ -1020,7 +1020,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
processModifierList();
|
||||
}
|
||||
else if (myRole1 == ChildRole.OPERATION_SIGN) {
|
||||
createSpaceInCode(mySettings.SPACE_AFTER_UNARY_OPERATOR);
|
||||
createSpaceInCode(mySettings.SPACE_AROUND_UNARY_OPERATOR);
|
||||
}
|
||||
else if (myChild1.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_TOKEN
|
||||
&& myChild2.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_TOKEN)
|
||||
|
||||
@@ -81,7 +81,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
|
||||
|
||||
public void testUnaryOperators() {
|
||||
// Inspired by IDEA-52127
|
||||
getSettings().SPACE_AFTER_UNARY_OPERATOR = false;
|
||||
getSettings().SPACE_AROUND_UNARY_OPERATOR = false;
|
||||
|
||||
String initial =
|
||||
"public class FormattingTest {\n" +
|
||||
@@ -100,7 +100,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
|
||||
|
||||
doTextTest(initial, initial); // Don't expect spaces to be inserted after unary operators
|
||||
|
||||
getSettings().SPACE_AFTER_UNARY_OPERATOR = true;
|
||||
getSettings().SPACE_AROUND_UNARY_OPERATOR = true;
|
||||
String formatted =
|
||||
"public class FormattingTest {\n" +
|
||||
" public void foo() {\n" +
|
||||
|
||||
@@ -516,6 +516,8 @@ public class CodeStyleSettings implements Cloneable, JDOMExternalizable {
|
||||
*/
|
||||
public boolean SPACE_AROUND_SHIFT_OPERATORS = true;
|
||||
|
||||
public boolean SPACE_AROUND_UNARY_OPERATOR = false;
|
||||
|
||||
public boolean SPACE_AFTER_COMMA = true;
|
||||
public boolean SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = true;
|
||||
public boolean SPACE_BEFORE_COMMA = false;
|
||||
@@ -607,7 +609,6 @@ public class CodeStyleSettings implements Cloneable, JDOMExternalizable {
|
||||
public boolean SPACE_WITHIN_ARRAY_INITIALIZER_BRACES = false;
|
||||
|
||||
public boolean SPACE_AFTER_TYPE_CAST = true;
|
||||
public boolean SPACE_AFTER_UNARY_OPERATOR = false;
|
||||
|
||||
/**
|
||||
* "f (x)"
|
||||
@@ -1276,6 +1277,9 @@ public class CodeStyleSettings implements Cloneable, JDOMExternalizable {
|
||||
JSP_INDENT_OPTIONS.SMART_TABS = value;
|
||||
XML_INDENT_OPTIONS.SMART_TABS = value;
|
||||
OTHER_INDENT_OPTIONS.SMART_TABS = value;
|
||||
} else if ("SPACE_AFTER_UNARY_OPERATOR".equals(name)) {
|
||||
final boolean value = Boolean.valueOf(option.getAttributeValue("value")).booleanValue();
|
||||
SPACE_AROUND_UNARY_OPERATOR = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -65,6 +65,8 @@ public class CodeStyleSpacesPanel extends OptionTreeWithPreviewPanel {
|
||||
SPACES_AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_SHIFT_OPERATORS", ApplicationBundle.message("checkbox.spaces.shift.operators"),
|
||||
SPACES_AROUND_OPERATORS);
|
||||
initBooleanField("SPACE_AROUND_UNARY_OPERATOR", ApplicationBundle.message("checkbox.spaces.around.unary.operator"),
|
||||
SPACES_AROUND_OPERATORS);
|
||||
initCustomOptions(SPACES_AROUND_OPERATORS);
|
||||
|
||||
initBooleanField("SPACE_BEFORE_CLASS_LBRACE", ApplicationBundle.message("checkbox.spaces.class.left.brace"), SPACES_BEFORE_LEFT_BRACE);
|
||||
@@ -120,7 +122,6 @@ public class CodeStyleSpacesPanel extends OptionTreeWithPreviewPanel {
|
||||
initBooleanField("SPACE_BEFORE_SEMICOLON", ApplicationBundle.message("checkbox.spaces.before.semicolon"), SPACES_OTHER);
|
||||
initBooleanField("SPACE_AFTER_SEMICOLON", ApplicationBundle.message("checkbox.spaces.after.semicolon"), SPACES_OTHER);
|
||||
initBooleanField("SPACE_AFTER_TYPE_CAST", ApplicationBundle.message("checkbox.spaces.after.type.cast"), SPACES_OTHER);
|
||||
initBooleanField("SPACE_AFTER_UNARY_OPERATOR", ApplicationBundle.message("checkbox.spaces.after.unary.operator"), SPACES_OTHER);
|
||||
initCustomOptions(SPACES_OTHER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,6 +256,7 @@ checkbox.spaces.bitwise.operators=Bitwise operators (\\&, |, ^)
|
||||
checkbox.spaces.additive.operators=Additive operators (+, -)
|
||||
checkbox.spaces.multiplicative.operators=Multiplicative operators (*, /, %)
|
||||
checkbox.spaces.shift.operators=Shift operators (<<, >>, >>>)
|
||||
checkbox.spaces.around.unary.operator=Unary operators (!, -, +, ++, --)
|
||||
checkbox.spaces.class.left.brace=Class left brace
|
||||
checkbox.spaces.method.left.brace=Method left brace
|
||||
checkbox.spaces.if.left.brace="if" left brace
|
||||
@@ -286,7 +287,6 @@ checkbox.spaces.before.comma=Before comma
|
||||
checkbox.spaces.after.semicolon=After semicolon
|
||||
checkbox.spaces.before.semicolon=Before semicolon
|
||||
checkbox.spaces.after.type.cast=After type cast
|
||||
checkbox.spaces.after.unary.operator=After unary operator
|
||||
title.warning=Warning
|
||||
title.editor=Editor
|
||||
combobox.strip.modified.lines=Modified Lines
|
||||
|
||||
Reference in New Issue
Block a user