void (@NotNull HighlightingSession hostSession) { ApplicationManager.getApplication().assertIsNonDispatchThread(); ApplicationManager.getApplication().assertReadAccessAllowed(); HighlightUsagesHandlerBase<PsiElement> highlightUsagesHandler = HighlightUsagesHandler.createCustomHandler(myEditor, myFile, myVisibleRange); boolean runFindUsages = true; if (highlightUsagesHandler != null) { List<PsiElement> targets = highlightUsagesHandler.getTargets(); highlightUsagesHandler.computeUsages(targets); List<TextRange> readUsages = highlightUsagesHandler.getReadUsages(); for (TextRange readUsage : readUsages) { LOG.assertTrue(readUsage != null, "null text range from " + highlightUsagesHandler); } myReadAccessRanges.addAll(readUsages); List<TextRange> writeUsages = highlightUsagesHandler.getWriteUsages(); for (TextRange writeUsage : writeUsages) { LOG.assertTrue(writeUsage != null, "null text range from " + highlightUsagesHandler); } myWriteAccessRanges.addAll(writeUsages); if (!highlightUsagesHandler.highlightReferences()) { runFindUsages = false; } } if (runFindUsages) { collectCodeBlockMarkerRanges(); highlightReferencesAndDeclarations(); } if (!myEditor.isDisposed()) { boolean virtSpace = EditorUtil.isCaretInVirtualSpace(myEditor); List<HighlightInfo> infos = virtSpace || isCaretOverCollapsedFoldRegion() ? Collections.emptyList() : getHighlights(); PsiFile hostFile = InjectedLanguageManager.getInstance(myFile.getProject()).getTopLevelFile(myFile); Editor hostEditor = InjectedLanguageEditorUtil.getTopLevelEditor(myEditor); BackgroundUpdateHighlightersUtil.setHighlightersInRange(hostFile.getTextRange(), infos, (MarkupModelEx)hostEditor.getMarkupModel(), getId(), hostSession); } }