[TxMt] Re: Language Server Protocol (LSP)

f1nnix ilya at rusanen.co.uk
Fri Dec 20 16:06:34 UTC 2019


Some updates.

I've implemented simple stdio client to LS, and it works for completion
requests. Also I've made ability to setup different LS (bin and env)
variables via `.tm_properties`.

Unfortunately, it seems there's a major limitation in TM callbacks. Some of
language servers strictly require didOpen, didChange and didClose
notifications for each opened file. In other words:

1. When user __first time__ opens document from project, we should notify
Language server. Callback `callback.document.did-open` runs __every time_
document gets focus, for example it you switch tabs. It means we should
manage list of opened documents manually, which can't be done on TM side,
but can be implemented on proxy-side. So it not an actual problem, but if
there a callback for actual document first open event, it's better.

2. To get completions, we should notify sever a new document is opened (see
1) before. And when we open document, then we need to notify Language server
about it's every change as document "truth" can't be read from file since
opening.

Though specification clearly says "Note that a server’s ability to fulfill
requests is independent of whether a text document is open or closed.", some
popular language servers refuse to fulfill completion requests until
document explicitly opened.

And this means unless we are able notify server on every content change of
opened document in realtime, we can't make completion requests for major
part for Language Server implementations. Is there a way to run command on
every content change?

3. The same as 1. When document is closed, we need to notify LS about it. I
can't find any info about document.close callback
(https://github.com/textmate/textmate/search?q=callback.document.did-close&unscoped_q=callback.document.did-close&type=Commits).
Is it true there is no such callback?







--
Sent from: http://textmate.1073791.n5.nabble.com/textmate-users-f3.html


More information about the TextMate mailing list