void (int group, @NotNull HighlightInfo info, @NotNull PsiFile psiFile, @Nullable RangeHighlighter toReuse) { ThreadingAssertions.assertEventDispatchThread(); assertMyFile(psiFile.getProject(), psiFile); VirtualFile vFile = BackedVirtualFile.getOriginFileIfBacked(psiFile.getViewProvider().getVirtualFile()); FileEditorManager fileEditorManager = getFileEditorManager(); for (FileEditor fileEditor : fileEditorManager.getAllEditors(vFile)) { if (fileEditor instanceof TextEditor textEditor) { List<Pair<HighlightInfo.IntentionActionDescriptor, TextRange>> actionRanges = new ArrayList<>(); info.findRegisteredQuickFix((descriptor, range) -> { actionRanges.add(Pair.create(descriptor, range)); return null; }); List<HighlightInfo> fileLevelInfos = fileEditor.getUserData(FILE_LEVEL_HIGHLIGHTS); if (fileLevelInfos == null) { fileLevelInfos = ContainerUtil.createConcurrentList(); // must be able to iterate in hasFileLevelHighlights() and concurrently modify in addFileLevelHighlight() fileEditor.putUserData(FILE_LEVEL_HIGHLIGHTS, fileLevelInfos); } if (!ContainerUtil.exists(fileLevelInfos, existing->existing.equalsByActualOffset(info))) { Document document = textEditor.getEditor().getDocument(); MarkupModel markupModel = DocumentMarkupModel.forDocument(document, myProject, true); RangeHighlighter highlighter = toReuse == null ? markupModel.addRangeHighlighter(0, document.getTextLength(), ANY_GROUP, null, HighlighterTargetArea.EXACT_RANGE) : toReuse; highlighter.setGreedyToLeft(true); highlighter.setGreedyToRight(true); highlighter.setErrorStripeTooltip(info); // for the condition `existing.equalsByActualOffset(info)` above work correctly, // create a fake whole-file highlighter which will track the document size changes // and which will make possible to calculate correct `info.getActualEndOffset()` info.setHighlighter((RangeHighlighterEx)highlighter); info.setGroup(group); fileLevelInfos.add(info); FileLevelIntentionComponent component = new FileLevelIntentionComponent(info.getDescription(), info.getSeverity(), info.getGutterIconRenderer(), actionRanges, psiFile, ((TextEditor)fileEditor).getEditor(), info.getToolTip()); fileEditorManager.addTopComponent(fileEditor, component); info.addFileLeverComponent(fileEditor, component); if (LOG.isDebugEnabled()) { LOG.debug("addFileLevelHighlight [" + info + "]: fileLevelInfos:" + fileLevelInfos); } } } } }