mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ensure tailing comments doesn't break statement in the middle (IDEA-188072)
This commit is contained in:
+2
-2
@@ -2,10 +2,10 @@
|
||||
|
||||
class Test {
|
||||
public static void main(String[] args) {
|
||||
//c2
|
||||
//c3
|
||||
if (args.length == 1 || args.length == 2) {
|
||||
return; // c1
|
||||
}
|
||||
}//c2
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,9 +4,9 @@ class Test {
|
||||
public static void main(String[] args) {
|
||||
i<caret>f (args.length == 1) {
|
||||
return; // c1
|
||||
}
|
||||
}//c2
|
||||
else if (args.length == 2) {
|
||||
return; //c2
|
||||
return; //c3
|
||||
}
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class MergeIfOrIntention extends Intention {
|
||||
statement.append(parentThenBranchText);
|
||||
final PsiStatement childElseBranch = childStatement.getElseBranch();
|
||||
if (childElseBranch != null) {
|
||||
statement.append("else ");
|
||||
statement.append("\nelse ");
|
||||
statement.append(tracker.text(childElseBranch));
|
||||
}
|
||||
PsiReplacementUtil.replaceStatement(parentStatement, statement.toString(), tracker);
|
||||
@@ -109,7 +109,7 @@ public class MergeIfOrIntention extends Intention {
|
||||
newStatement.append(parentTracker.text(parentThenBranch));
|
||||
final PsiStatement childElseBranch = childStatement.getElseBranch();
|
||||
if (childElseBranch != null) {
|
||||
newStatement.append("else ");
|
||||
newStatement.append("\nelse ");
|
||||
newStatement.append(childTracker.text(childElseBranch));
|
||||
}
|
||||
PsiReplacementUtil.replaceStatement(parentStatement, newStatement.toString(), parentTracker);
|
||||
|
||||
Reference in New Issue
Block a user