X-Git-Url: http://git.jetbrains.org/?p=idea%2Fcommunity.git;a=blobdiff_plain;f=platform%2Flang-impl%2Fsrc%2Fcom%2Fintellij%2FcodeInsight%2Fdaemon%2Fimpl%2FShowIntentionsPass.java;h=863a16d993429dfa606b2eddc69586b313fdd60b;hp=3a6c1b94ece72e98d3fa60cac10596ceef9ed7c8;hb=fab45b687e70c8c6437672e9ad4849786360b61b;hpb=c6f72e8329ac247fafa508bfcdf02678e473fc37 diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java index 3a6c1b94ece7..863a16d99342 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/ShowIntentionsPass.java @@ -86,9 +86,9 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { private volatile boolean myHasToRecreate; @NotNull - public static List getAvailableActions(@NotNull final Editor editor, - @NotNull final PsiFile file, - final int passId) { + public static List getAvailableFixes(@NotNull final Editor editor, + @NotNull final PsiFile file, + final int passId) { final int offset = ((EditorEx)editor).getExpectedCaretOffset(); final Project project = file.getProject(); @@ -96,16 +96,16 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { DaemonCodeAnalyzerImpl.processHighlightsNearOffset(editor.getDocument(), project, HighlightSeverity.INFORMATION, offset, true, new CommonProcessors.CollectProcessor<>(infos)); List result = new ArrayList<>(); - infos.forEach(info->addAvailableActionsForGroups(info, editor, file, result, passId, offset)); + infos.forEach(info-> addAvailableFixesForGroups(info, editor, file, result, passId, offset)); return result; } - private static void addAvailableActionsForGroups(@NotNull HighlightInfo info, - @NotNull Editor editor, - @NotNull PsiFile file, - @NotNull List outList, - int group, - int offset) { + private static void addAvailableFixesForGroups(@NotNull HighlightInfo info, + @NotNull Editor editor, + @NotNull PsiFile file, + @NotNull List outList, + int group, + int offset) { if (info.quickFixActionMarkers == null) return; if (group != -1 && group != info.getGroup()) return; boolean fixRangeIsNotEmpty = !info.getFixTextRange().isEmpty(); @@ -157,7 +157,7 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { public final List guttersToShow = ContainerUtil.createLockFreeCopyOnWriteList(); public final List notificationActionsToShow = ContainerUtil.createLockFreeCopyOnWriteList(); - public void filterActions(@Nullable PsiFile psiFile) { + void filterActions(@Nullable PsiFile psiFile) { IntentionActionFilter[] filters = IntentionActionFilter.EXTENSION_POINT_NAME.getExtensions(); filter(intentionsToShow, psiFile, filters); filter(errorFixesToShow, psiFile, filters); @@ -287,7 +287,7 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { int offset = hostEditor.getCaretModel().getOffset(); final Project project = hostFile.getProject(); - List fixes = getAvailableActions(hostEditor, hostFile, passIdToShowIntentionsFor); + List fixes = getAvailableFixes(hostEditor, hostFile, passIdToShowIntentionsFor); final DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(project); final Document hostDocument = hostEditor.getDocument(); HighlightInfo infoAtCursor = ((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(hostDocument, offset, true); @@ -396,6 +396,7 @@ public class ShowIntentionsPass extends TextEditorHighlightingPass { PsiElement el = psiElement; while (el != null) { elements.add(el); + if (el instanceof PsiFile) break; el = el.getParent(); }