diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java index 8072fc8417f8..291546a67dda 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java @@ -998,7 +998,16 @@ public final class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx boolean includeFixRange, boolean highestPriorityOnly, @NotNull HighlightSeverity minSeverity) { - HighlightByOffsetProcessor processor = new HighlightByOffsetProcessor(highestPriorityOnly); + return findHighlightsByOffset(document, offset, includeFixRange, highestPriorityOnly, minSeverity, true); + } + @ApiStatus.Internal + public @Nullable HighlightInfo findHighlightsByOffset(@NotNull Document document, + int offset, + boolean includeFixRange, + boolean highestPriorityOnly, + @NotNull HighlightSeverity minSeverity, + boolean includeFileLevel) { + HighlightByOffsetProcessor processor = new HighlightByOffsetProcessor(highestPriorityOnly, includeFileLevel); processHighlightsNearOffset(document, myProject, minSeverity, offset, includeFixRange, processor); return processor.getResult(); } @@ -1035,14 +1044,19 @@ public final class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx static final class HighlightByOffsetProcessor implements Processor { private final List foundInfoList = new SmartList<>(); private final boolean highestPriorityOnly; + private final boolean myIncludeFileLevel; - HighlightByOffsetProcessor(boolean highestPriorityOnly) { + HighlightByOffsetProcessor(boolean highestPriorityOnly, boolean includeFileLevel) { this.highestPriorityOnly = highestPriorityOnly; + myIncludeFileLevel = includeFileLevel; } @Override public boolean process(@NotNull HighlightInfo info) { - if (info.getSeverity() == HighlightInfoType.ELEMENT_UNDER_CARET_SEVERITY || info.type == HighlightInfoType.TODO) { + if (info.getSeverity() == HighlightInfoType.ELEMENT_UNDER_CARET_SEVERITY + || info.type == HighlightInfoType.TODO + || !myIncludeFileLevel && info.isFileLevelAnnotation() + ) { return true; } 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 3f7620a7c33d..aa44a7db0059 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 @@ -298,7 +298,7 @@ public final class ShowIntentionsPass extends TextEditorHighlightingPass impleme intentions.setOffset(offset); List fixes = new ArrayList<>(); - DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor highestPriorityInfoFinder = new DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor(true); + DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor highestPriorityInfoFinder = new DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor(true, true); List infos = new ArrayList<>(); List additionalInfos = new ArrayList<>(); Document document = hostEditor.getDocument(); diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/EditorMouseHoverPopupManager.java b/platform/lang-impl/src/com/intellij/openapi/editor/EditorMouseHoverPopupManager.java index 4954d1d3dd27..c87e7f9b7070 100644 --- a/platform/lang-impl/src/com/intellij/openapi/editor/EditorMouseHoverPopupManager.java +++ b/platform/lang-impl/src/com/intellij/openapi/editor/EditorMouseHoverPopupManager.java @@ -345,7 +345,7 @@ public class EditorMouseHoverPopupManager implements Disposable { DaemonCodeAnalyzerImpl daemonCodeAnalyzer = (DaemonCodeAnalyzerImpl)DaemonCodeAnalyzer.getInstance(project); boolean highestPriorityOnly = !Registry.is("ide.tooltip.showAllSeverities"); info = daemonCodeAnalyzer - .findHighlightsByOffset(editor.getDocument(), offset, false, highestPriorityOnly, HighlightInfoType.SYMBOL_TYPE_SEVERITY); + .findHighlightsByOffset(editor.getDocument(), offset, false, highestPriorityOnly, HighlightInfoType.SYMBOL_TYPE_SEVERITY, false); } PsiElement elementForQuickDoc = findElementForQuickDoc(editor, offset, project);