Add experimental eglot support (won't be merged)#58
Conversation
|
Thanks for this! I tried with two lsp, in the next days I'll be trying more (Note: I'm using a Linux distribution that symlinks
{"message":"Error loading packages: err: chdir /var/home/selenil/dev/go_devcontainer: no such file or directory: stderr: "}When Eglot tries to do more work the server just keep replying with the same error. At some points this happens: {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///workspaces/go_devcontainer/../../../../var/home/selenil/dev/go_devcontainer/main.go","diagnostics":[{"range":{"start":{"line":0,"character":8},"end":{"line":0,"character":12}},"severity":2,"source":"go list","message":"No active builds contain /workspaces/go_devcontainer/../../../../var/home/selenil/dev/go_devcontainer/main.go: consider opening a new workspace folder containing it"}]}}And from there, the server keeps running but it ignores interactions with: {"jsonrpc":"2.0","error":{"code":0,"message":"no views"},"id":3}
Diggin into the messages I found that Eglot sends incorrect uris. For a file in
In some early tests I did advising |
That's interesting. Not sure if it's related to the |
|
Another issue that I came across in real life testing is, that maybe not all LSPs can be expected to run in the container. So we need some way of deciding if we do the path uri translation or not depending on if the LSP server is running inside or outside the container. |
f1a8df1 to
c085a3a
Compare
|
I found that most of my issues were caused due to my distribution symlinking Aside from that, the other issue I have is that |
This adds experimental support for eglot by doing the following: * advice: `eglot-path-to-uri` and `eglot-uri-to-path` to translate back and forth the file path and file uris * provide the function `devcontainer-eglot-server` that sets up a language server for eglot inside the container if appropriate
c085a3a to
61046cd
Compare
I was doing some debugging and it turns out that this issue is actually caused by the |
It turns out that the overhead of figuring out the path inside the container slows down `eglot-path-to-uri` and `eglot-uri-to-path` significantly. Now we are caching it for every file in a hash-table
Exploring LSP support
This adds experimental support for eglot by doing the following:
advise
eglot-path-to-uriandeglot-uri-to-pathto translate back and forth the file path and file urisprovide the functiondevcontainer-eglot-serverthat sets up a language server for eglot inside the container if appropriateadvise
eglot--connectto injectdevcontainer exec -ito the LSP launch commandExample:
Open points
docker execautomatically if appropriate. The solution withdevcontainer-eglot-serveris somewhat clunky (probably better to adviseeglot--connect)eglotthen would calleglot--reconnectand we must somehow deal with the fact, that at that point the devcontainer is most probably still not running.