Conversation
| // `InitializeParams.intitializationOptions` if absent from the | ||
| // `InitializeParams`. This makes go-langserver more LSP-compliant so that | ||
| // clients don't need to go outside of the LSP specification to communicate | ||
| // with it. |
There was a problem hiding this comment.
Note that this is still not really compliant from a semantics perspective because initializationOptions is intended to be options you would pass through CLI arguments, i.e. not values that change for every workspace.
Could you give some examples of such assumptions? |
|
Here are a few examples: go-langserver/buildserver/environment.go Line 104 in 33d2968 go-langserver/langserver/handler_common.go Lines 32 to 35 in 33d2968 go-langserver/langserver/loader.go Line 40 in 33d2968 Unless this PR looks ok, I'll try moving forward with moving |
|
Closing in favor of #373 |
Background
Because
originalRootURIis 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
originalRootURIfromInitializeParams.initializationOptionsif it's absent from the top levelInitializeParams. It will still be compatible with existing clients that currently putoriginalRootURIin the top levelInitializeParams.One other alternative considered
Alternatively, the
InitializeParams.rootURImight be able to carry the current value oforiginalRootURIbecause 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 sourcegraph/sourcegraph-go#28