boolean (@NotNull HighlightingSession session, @NotNull PsiFile file, @NotNull Document document, @NotNull TextRange restrictRange, @NotNull HighlightInfo info, @Nullable EditorColorsScheme colorsScheme, // if null, the global scheme will be used int group, @NotNull Long2ObjectMap<RangeMarker> range2markerCache) { ApplicationManager.getApplication().assertIsNonDispatchThread(); ApplicationManager.getApplication().assertReadAccessAllowed(); Project project = file.getProject(); if (!UpdateHighlightersUtil.HighlightInfoPostFilters.accept(project, info)) { return false; } if (UpdateHighlightersUtil.isFileLevelOrGutterAnnotation(info)) return false; if (!restrictRange.intersects(info)) return false; MarkupModel markup = DocumentMarkupModel.forDocument(document, project, true); SeverityRegistrar severityRegistrar = SeverityRegistrar.getSeverityRegistrar(project); boolean myInfoIsError = UpdateHighlightersUtil.isSevere(info, severityRegistrar); HighlightersRecycler recycler = new HighlightersRecycler(); Processor<HighlightInfo> otherHighlightInTheWayProcessor = oldInfo -> { if (!myInfoIsError && UpdateHighlightersUtil.isCovered(info, severityRegistrar, oldInfo)) { return false; } RangeHighlighterEx oldHighlighter = oldInfo.highlighter; if (oldHighlighter != null && oldInfo.equals(info)) { recycler.recycleHighlighter(oldHighlighter); } return !(Objects.equals(oldInfo.toolId, info.toolId) && oldInfo.equalsByActualOffset(info)); }; boolean allIsClear = DaemonCodeAnalyzerEx.processHighlights(document, project, null, info.getActualStartOffset(), info.getActualEndOffset(), otherHighlightInTheWayProcessor); try { if (allIsClear) { createOrReuseHighlighterFor(info, colorsScheme, document, group, file, (MarkupModelEx)markup, recycler, range2markerCache, severityRegistrar); UpdateHighlightersUtil.incinerateObsoleteHighlighters(recycler, session); UpdateHighlightersUtil.clearWhiteSpaceOptimizationFlag(document); return true; } } finally { recycler.releaseHighlighters(); } return false; }