do not show highlight tooltips on hover on file-level info because they are extremely in the way otherwise; to fix IJPL-171293 File-Level errors are showing an unneeded tooltip on mouse moves

GitOrigin-RevId: d0e66a8a7da278bca18cef81d169d63ec10e7748
This commit is contained in:
Alexey Kudravtsev
2024-11-12 19:22:29 +00:00
committed by intellij-monorepo-bot
parent 6b317ed535
commit 7b341bae97
3 changed files with 19 additions and 5 deletions
@@ -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<HighlightInfo> {
private final List<HighlightInfo> 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;
}
@@ -298,7 +298,7 @@ public final class ShowIntentionsPass extends TextEditorHighlightingPass impleme
intentions.setOffset(offset);
List<HighlightInfo.IntentionActionDescriptor> fixes = new ArrayList<>();
DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor highestPriorityInfoFinder = new DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor(true);
DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor highestPriorityInfoFinder = new DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor(true, true);
List<HighlightInfo> infos = new ArrayList<>();
List<HighlightInfo> additionalInfos = new ArrayList<>();
Document document = hostEditor.getDocument();
@@ -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);