mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
join lines do not merge closing brace and catch keyword, when 'catch on new line' enabled (IDEA-179581)
This commit is contained in:
@@ -712,7 +712,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
private void processOnNewLineCondition(boolean onNewLine, boolean createSpaceInline) {
|
||||
if (onNewLine) {
|
||||
if (!mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE) {
|
||||
myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
myResult = Spacing.createSpacing(1, 1, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
}
|
||||
else {
|
||||
myResult = Spacing.createDependentLFSpacing(0, 1, myParent.getTextRange(), mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
public void foo() {
|
||||
try {
|
||||
System.out.println("Hello");
|
||||
}<caret>
|
||||
catch (Exception e) {
|
||||
System.err.println("Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
public void foo() {
|
||||
try {
|
||||
System.out.println("Hello");
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,6 +231,12 @@ public class JoinLinesTest extends LightCodeInsightTestCase {
|
||||
|
||||
public void testMultipleBlockComments() { doTest(); }
|
||||
|
||||
public void testPreserveSpaceIfOnNewLineOptionEnabled() {
|
||||
CommonCodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject()).getCommonSettings(JavaLanguage.INSTANCE);
|
||||
settings.CATCH_ON_NEW_LINE = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(".java");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user