Open PEZ opened 2 years ago
The LSP spec is clear about server should handle a URI even if it's not saved on filesystem, that is required for LSPs work on remote filesystems etc.
For this case, it seems to me there is not even a URI, so not sure would be possible to handle that, we need to check what vscode-language-client is sending on didOpen
or if it's not sending this at all
In VS Code the ”file” actually has a URI. Don't recall exactly, but something with untitled://
I think. It has a languageId
of clojure
too, maybe that is something sent with the request?
Maybe we can override it somehow and provide some phony Uri... I'll experiment a bit with it during the weekend.
yeah, the languageId is something only on client side I think, server doesn't use/check it, IIRC is not part of the spec.
But yeah, a URI is all we (should) need, probably a untitled://
would cause other issues tho
I was just reading the docs and this is probably what we need to add to createClient: { scheme: 'untitled', language: 'clojure' }
. The file
scheme apparently ignores untitled.
Sounds odd on the create client level. Can you link to the docs, @Cyrik ?
I was just reading the docs and this is probably what we need to add to createClient: { scheme: 'untitled', language: 'clojure' }. The file scheme apparently ignores untitled.
After reading the part of the docs linked, that does seem likely to work.
The part I don't understand here is why this would go in createClient
?
The "client" is just the basic vscode implementation that we add our stuff on top of. The documentSelector we provide to the client determines which files are seen as relevant. If a file is seen as irrelevant its contents/changes won't get sent to the LSP server, unless we interfere with the default behavior. Currently, we are saying:
documentSelector: [
{ scheme: 'file', language: 'clojure' },
{ scheme: 'jar', language: 'clojure' },
]
So any file or jar that is in the clojure language is relevant and sent to the lsp-server. untitled
does not fall into that definition, since it's not a file. So hopefully adding untitled
will just fix this problem 😄
Thanks! That was the context I was lacking. Makes total sense.
When using the VS Code command New file (
cmd/ctrl+n
) and set the language of it to Clojure, you have an Untitled file.This file gets no clojure-lsp support.
There is some discussion in #1666 around this.