void (@NotNull TextRange range, @NotNull List<? extends HighlightInfo> infos, @NotNull MarkupModelEx markup, int group, @NotNull HighlightingSession session) { ApplicationManager.getApplication().assertIsNonDispatchThread(); ApplicationManager.getApplication().assertReadAccessAllowed(); Project project = session.getProject(); List<HighlightInfo> toReuse = new ArrayList<>(); Document document = session.getDocument(); DaemonCodeAnalyzerEx.processHighlights(markup, project, null, range.getStartOffset(), range.getEndOffset(), info -> { if (info.getGroup() == group) { int hiEnd = info.getEndOffset(); boolean willBeRemoved = range.contains(info) || hiEnd == document.getTextLength() && range.getEndOffset() == hiEnd; if (willBeRemoved) { toReuse.add(info); } } return true; }); setHighlightersInRange(range, infos, markup, group, session, toReuse); }