mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
JavaFormatter: space before "{" processing corrected (fixes IDEA-127110). Now four cases are checked, depending on braces placement option:
- when place brace on the end of line is on - when option place brace next line if wrapped is on - when place brace on next line is on and keep simple blocks/methods/classes option is on - when place brace on next line is on
This commit is contained in:
@@ -242,4 +242,51 @@ public class JavaFormatterBracesTest extends AbstractJavaFormatterTest {
|
||||
doMethodTest(singleLine, multiLine);
|
||||
doMethodTest(multiLine, multiLine);
|
||||
}
|
||||
|
||||
public void testMethodBraceOnNextLineIfWrapped() {
|
||||
getSettings().METHOD_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED;
|
||||
getSettings().METHOD_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
|
||||
getSettings().RIGHT_MARGIN = 50;
|
||||
doClassTest(
|
||||
"public static void main(int state, int column, int width, int rate) {\n" +
|
||||
"}\n",
|
||||
"public static void main(int state, int column,\n" +
|
||||
" int width, int rate)\n" +
|
||||
"{\n" +
|
||||
"}\n"
|
||||
);
|
||||
}
|
||||
|
||||
public void testIDEA127110() {
|
||||
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
|
||||
getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED;
|
||||
doMethodTest(
|
||||
"if ( 1 > 2) {\n" +
|
||||
"\n" +
|
||||
"} else {\n" +
|
||||
"\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"try {\n" +
|
||||
"\n" +
|
||||
"} catch ( Exception e) {\n" +
|
||||
"\n" +
|
||||
"} finally {\n" +
|
||||
"\n" +
|
||||
"}",
|
||||
"if (1 > 2) {\n" +
|
||||
"\n" +
|
||||
"} else {\n" +
|
||||
"\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"try {\n" +
|
||||
"\n" +
|
||||
"} catch (Exception e) {\n" +
|
||||
"\n" +
|
||||
"} finally {\n" +
|
||||
"\n" +
|
||||
"}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user