void (@NotNull FileEditorManager editorManager, @NotNull VirtualFile file) { if (!(file instanceof VirtualFileWithId fileWithId)) { return; } FileEditor fileEditor = editorManager.getSelectedEditor(file); if (!(fileEditor instanceof TextEditor textEditor)) { return; } if (textEditor.getEditor().getEditorKind() != EditorKind.MAIN_EDITOR) { return; } Document document = FileDocumentManager.getInstance().getCachedDocument(file); if (document == null) { return; } EditorColorsScheme colorsScheme = textEditor.getEditor().getColorsScheme(); HighlightingMarkupStore.getExecutor().execute(() -> { ReadAction.run(() -> { FileMarkupInfo markupFromModel = getMarkupFromModel(document, colorsScheme); FileMarkupInfo storedMarkup = myMarkupStore.getMarkup(fileWithId); Boolean zombieDisposed = myResurrectedZombies.get(fileWithId.getId()); GraveDecision graveDecision = GraveDecision.getDecision(markupFromModel, storedMarkup, zombieDisposed); switch (graveDecision) { case STORE_NEW -> { myMarkupStore.putMarkup(fileWithId, markupFromModel); if (LOG.isDebugEnabled()) { LOG.debug("stored markup " + markupFromModel.size() + " for " + file); } } case REMOVE_OLD -> { myMarkupStore.removeMarkup(fileWithId); if (LOG.isDebugEnabled() && storedMarkup != null) { LOG.debug("removed outdated markup " + storedMarkup.size() + " for " + file); } } case KEEP_OLD -> { if (LOG.isDebugEnabled() && storedMarkup != null) { LOG.debug("preserved markup " + storedMarkup.size() + " for " + file); } } } }); }); }