void (@NotNull EditorHighlighter highlighter) { if (isReleased) { // do not set highlighter to the released editor return; } assertIsDispatchThread(); WriteIntentReadAction.run((Runnable)() -> { Document document = getDocument(); Disposer.dispose(myHighlighterDisposable); document.addDocumentListener(highlighter); myHighlighterDisposable = () -> document.removeDocumentListener(highlighter); Disposer.register(myDisposable, myHighlighterDisposable); highlighter.setEditor(this); highlighter.setText(document.getImmutableCharSequence()); if (!(highlighter instanceof EmptyEditorHighlighter)) { EditorHighlighterCache.rememberEditorHighlighterForCachesOptimization(document, highlighter); } EditorHighlighter oldHighlighter = myHighlighter; myHighlighter = highlighter; myPropertyChangeSupport.firePropertyChange(EditorEx.PROP_HIGHLIGHTER, oldHighlighter, highlighter); if (myPanel != null) { reinitSettings(); } }); }