mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
preserve comments: invert if in case when else branch become empty
This commit is contained in:
+1
-1
@@ -142,7 +142,7 @@ public class InvertIfConditionAction extends PsiElementBaseIntentionAction {
|
||||
elseBranch = Objects.requireNonNull(ifStatement.getElseBranch()).replace(elseBranch);
|
||||
|
||||
if (emptyBlock(((PsiBlockStatement)elseBranch).getCodeBlock())) {
|
||||
ifStatement.getElseBranch().delete();
|
||||
new CommentTracker().deleteAndRestoreComments(ifStatement.getElseBranch());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Invert 'if' condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
if (c) {
|
||||
}
|
||||
//c1
|
||||
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Invert 'if' condition" "true"
|
||||
class A {
|
||||
public void foo() {
|
||||
<caret>if (!c) {
|
||||
continue;
|
||||
}//c1
|
||||
System.out.println();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user