diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java index 4c22b74aa..b1019d4cc 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/LanguageServerWrapper.java @@ -604,7 +604,7 @@ private boolean supportsWorkspaceFolderCapability() { TextDocumentSyncKind syncKind = initializeFuture == null ? null : serverCapabilities.getTextDocumentSync().map(Functions.identity(), TextDocumentSyncOptions::getChange); final var listener = new DocumentContentSynchronizer(this, languageServer, theDocument, syncKind); - theDocument.addDocumentListener(listener); + theDocument.addPrenotifiedDocumentListener(listener); LanguageServerWrapper.this.connectedDocuments.put(uri, listener); } }).thenApply(theVoid -> this); @@ -618,7 +618,7 @@ public CompletableFuture disconnect(URI uri) { DocumentContentSynchronizer documentListener = this.connectedDocuments.remove(uri); CompletableFuture documentClosedFuture = null; if (documentListener != null) { - documentListener.getDocument().removeDocumentListener(documentListener); + documentListener.getDocument().removePrenotifiedDocumentListener(documentListener); documentClosedFuture = documentListener.documentClosed(); } if (this.connectedDocuments.isEmpty()) {