don't let indexing use meaningless empty editor highlighter
authorpeter <peter@jetbrains.com>
Tue, 3 May 2016 20:52:07 +0000 (22:52 +0200)
committerpeter <peter@jetbrains.com>
Tue, 3 May 2016 20:55:40 +0000 (22:55 +0200)
platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java

index 361a49b9fe74d185ab23b5235e8842fb8dff34be..79639d8ecc0c5df739ab6b063ce33e2e9381a76b 100644 (file)
@@ -1174,16 +1174,13 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
 
     document.addDocumentListener(highlighter);
     myHighlighter = highlighter;
 
     document.addDocumentListener(highlighter);
     myHighlighter = highlighter;
-    myHighlighterDisposable = new Disposable() {
-      @Override
-      public void dispose() {
-        document.removeDocumentListener(highlighter);
-      }
-    };
+    myHighlighterDisposable = () -> document.removeDocumentListener(highlighter);
     Disposer.register(myDisposable, myHighlighterDisposable);
     highlighter.setEditor(this);
     highlighter.setText(document.getImmutableCharSequence());
     Disposer.register(myDisposable, myHighlighterDisposable);
     highlighter.setEditor(this);
     highlighter.setText(document.getImmutableCharSequence());
-    EditorHighlighterCache.rememberEditorHighlighterForCachesOptimization(document, highlighter);
+    if (!(highlighter instanceof EmptyEditorHighlighter)) {
+      EditorHighlighterCache.rememberEditorHighlighterForCachesOptimization(document, highlighter);
+    }
 
     if (myPanel != null) {
       reinitSettings();
 
     if (myPanel != null) {
       reinitSettings();