disable "insert new" fix on invalid code

This commit is contained in:
peter
2017-07-25 13:15:10 +02:00
parent 5c73467c47
commit 99dec77a5a
2 changed files with 10 additions and 1 deletions
@@ -47,7 +47,7 @@ public class InsertNewFix implements IntentionAction {
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
return myMethodCall.isValid() && myMethodCall.getManager().isInProject(myMethodCall);
return myMethodCall.isValid() && myMethodCall.getManager().isInProject(myMethodCall) && !(myMethodCall.getNextSibling() instanceof PsiErrorElement);
}
@NotNull
@@ -0,0 +1,9 @@
// "Insert new" "false"
class a {
void f() {
if (Runtime<caret>Exception() {
}
}
}