Reputation: 123
I'm developing a language server (and client) for VS Code based on the official "lsp-sample". According to the documentation (Language Server Extension Guide), setting the capability textDocumentSync: TextDocumentSyncKind.Incremental
should enable the language server to receive the events onDidOpenTextDocument
, onDidChangeTextDocument
and onDidCloseTextDocument
.
However, VS Code does not appear to send these events to the language server, and breakpoints in the event handlers (e.g. on this line) are not hit (breakpoints in other event handlers are hit, though, so debugging the language server does work).
What could be wrong in the client or server configurations that would prevent VS Code from sending these events?
Upvotes: 1
Views: 658
Reputation: 123
After lots of debugging of the language client I found the issue: On startup, my language server prints something to stdout to indicate that it's ready. Since the language server is communicating via stdout/stdin, VS Code (correctly) interprets this as a violation of the protocol, causing the whole thing to not even start correctly. Removing the print statement resolved the issue.
Surprisingly, the LSP plugin in Sublime Text apparently ignored this protocol violation and continued to function despite my faulty language server implementation.
Upvotes: 1