mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-75064: throws keyword align
This commit is contained in:
+3
@@ -272,6 +272,9 @@ public class GroovyIndentProcessor extends GroovyElementVisitor {
|
||||
if (myChildType == PARAMETERS_LIST) {
|
||||
myResult = Indent.getContinuationIndent();
|
||||
}
|
||||
else if (myChildType == THROW_CLAUSE) {
|
||||
myResult = getGroovySettings(method).ALIGN_THROWS_KEYWORD ? Indent.getNoneIndent() : Indent.getContinuationIndent();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
-3
@@ -397,7 +397,12 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
createSpaceInCode(mySettings.SPACE_WITHIN_METHOD_PARENTHESES);
|
||||
}
|
||||
else if (myType1 == mRPAREN && myType2 == THROW_CLAUSE) {
|
||||
createSpaceInCode(true);
|
||||
if (mySettings.THROWS_KEYWORD_WRAP == CommonCodeStyleSettings.WRAP_ALWAYS) {
|
||||
createLF();
|
||||
}
|
||||
else {
|
||||
createSpaceInCode(true);
|
||||
}
|
||||
}
|
||||
else if (isOpenBlock(myType2)) {
|
||||
PsiElement methodName = method.getNameIdentifier();
|
||||
@@ -713,7 +718,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
} else if (mySettings.KEEP_CONTROL_STATEMENT_IN_ONE_LINE) {
|
||||
myResult = Spacing.createDependentLFSpacing(1, 1, myParent.getTextRange(), false, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
} else {
|
||||
myResult = Spacing.createSpacing(0, 0, 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
createLF();
|
||||
}
|
||||
}
|
||||
else if (myType1 == mRPAREN) {
|
||||
@@ -837,10 +842,14 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
|
||||
mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
}
|
||||
else {
|
||||
myResult = Spacing.createSpacing(0, 0, 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
createLF();
|
||||
}
|
||||
}
|
||||
|
||||
private void createLF() {
|
||||
myResult = Spacing.createSpacing(0, 0, 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
}
|
||||
|
||||
private Spacing createNonLFSpace(int spaces, @Nullable final TextRange dependantRange, final boolean keepLineBreaks) {
|
||||
final ASTNode prev = getPrevElementType(myChild2);
|
||||
if (prev != null && prev.getElementType() == mSL_COMMENT) {
|
||||
|
||||
+20
-2
@@ -43,7 +43,11 @@ public class FormatterTest extends GroovyFormatterTestCase {
|
||||
public void testArg2() throws Throwable { doTest(); }
|
||||
public void testBin1() throws Throwable { doTest(); }
|
||||
public void testBin2() throws Throwable { doTest(); }
|
||||
public void testBlockExpr1() throws Throwable { doTest(); }
|
||||
public void testBlockExpr1() throws Throwable {
|
||||
//groovySettings.KEEP_CONTROL_STATEMENT_IN_ONE_LINE = false
|
||||
groovySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = false
|
||||
doTest();
|
||||
}
|
||||
public void testClass1() throws Throwable { doTest(); }
|
||||
public void testClo1() throws Throwable { doTest(); }
|
||||
public void testClo2() throws Throwable { doTest(); }
|
||||
@@ -109,7 +113,10 @@ public class FormatterTest extends GroovyFormatterTestCase {
|
||||
public void testWhileCStyle() throws Throwable { doTest(); }
|
||||
public void testFields() throws Throwable { doTest(); }
|
||||
|
||||
public void testClosureAfterLineComment() throws Throwable { doTest(); }
|
||||
public void testClosureAfterLineComment() throws Throwable {
|
||||
groovySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = false
|
||||
doTest();
|
||||
}
|
||||
public void testAnnotationOnSeparateLine() throws Throwable { doTest(); }
|
||||
public void testAlignMultipleVariables() throws Throwable { doTest(); }
|
||||
|
||||
@@ -350,6 +357,17 @@ for (; abc;)
|
||||
|
||||
}
|
||||
|
||||
void testWrapThrows() {
|
||||
groovySettings.THROWS_KEYWORD_WRAP = CommonCodeStyleSettings.WRAP_ALWAYS
|
||||
|
||||
checkFormatting('''\
|
||||
def foo() throws X {}
|
||||
''', '''\
|
||||
def foo()
|
||||
throws X {}
|
||||
''')
|
||||
}
|
||||
|
||||
private void doGeeseTest() {
|
||||
GroovyCodeStyleSettings customSettings = myTempSettings.getCustomSettings(GroovyCodeStyleSettings.class);
|
||||
boolean oldvalue = customSettings.USE_FLYING_GEESE_BRACES;
|
||||
|
||||
Reference in New Issue
Block a user