Closed chrismwendt closed 5 years ago
After attempting to move originalRootURI to rootUri for ~2 hours, I'm finding that the assumption that rootUri is file:/// pervades the LSP request handlers, utility functions, and glue code. Changing it will take longer than I had expected and I'm concerned it might introduce bugs despite the pretty good test coverage of go-langserver.
Could you give some examples of such assumptions?
Here are a few examples:
Unless this PR looks ok, I'll try moving forward with moving originalRootURI
to rootUri
tomorrow. Currently, same-repo j2d returns file:
URIs whereas cross-repo j2d returns git:
URIs, and I think that moving originalRootURI
to rootUri
will make that uniform so they're all git:
URIs, which would simplify the Go Sourcegraph extension a bit and avoid the need for another parameter to the serverToClientURI
function in lsp-client.
Closing in favor of https://github.com/sourcegraph/go-langserver/pull/373
Background
Because
originalRootURI
is not part of the LSP specification forInitializeParams
, clients cannot use LSP-conformant libraries such as https://github.com/sourcegraph/lsp-client without adding a workaround specifically for communicating with go-langserver.There is an untyped field,
InitializeParams.initializationOptions
, which can easily be used to send theoriginalRootURI
.Details
After this change, go-langserver will read the
originalRootURI
fromInitializeParams.initializationOptions
if it's absent from the top levelInitializeParams
. It will still be compatible with existing clients that currently putoriginalRootURI
in the top levelInitializeParams
.One other alternative considered
Alternatively, the
InitializeParams.rootURI
might be able to carry the current value oforiginalRootURI
because it's currently set to the informationless value offile:///
in sourcegraph-go. However, this change seems difficult to make in go-langserver:This helps integrate lsp-client into the Go extension https://github.com/sourcegraph/sourcegraph-go/issues/28