void (@NotNull Editor editor, @NotNull Project project) { HighlightManager highlightManager = HighlightManager.getInstance(project); editor.getCaretModel().runForEachCaret(caret -> { if (caret.hasSelection()) { highlightManager.addOccurrenceHighlight(editor, caret.getSelectionStart(), caret.getSelectionEnd(), EditorColors.SEARCH_RESULT_ATTRIBUTES, HIDE_BY_ESCAPE | HIDE_BY_ANY_KEY, null); } }); }