x/tools/gopls: provide means by which client can set session options post Initialize #39050
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Tools
This label describes issues relating to any tools in the x/tools repository.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Currently, when a client notifies the server of a
DidChangeConfiguration
,gopls
makes aConfiguration
call to the client for eachView
(workspace):https://github.com/golang/tools/blob/aaeff5de670acfcdd4758eaea55e2a86ca6ac802/internal/lsp/workspace.go#L47-L57
Each call is made with a
[]protocol.ConfigurationItem
of length 2. The first item is a section named"gopls"
, the second is named according to the format"gopls-$VIEWNAME"
.The client should respond with
n <= 2
configuration maps corresponding to the[]protocol.ConfigurationItem
sent.The configuration for each view is then determined as follows: take the current session configuration (set at
Initialize
time), then apply each of the configuration maps returned by the client. In effect there is a cascade, with the more specific"gopls-$VIEWNAME"
configuration map "winning". The"gopls"
section can be considered a "default workspace" config.There are three issues that arise from this setup:
Initialize
Configuration
calls are made than is necessary"gopls"
section is somewhat confused by the fact that a different value can be returned for then
Configuration
calls corresponding ton
workspaces (views)This issue is primarily about fixing the first of these points. A client should be able to update the session options post
Initialize
.Perhaps one way of achieving this would be for a
Configuration
call from server to client to pass[]protocol.ConfigurationItem
with the following sections:Clearly this will need some thought with respect to the various
gopls
clients, so the idea above is really just to kick-start discussion.cc @stamblerre @findleyr @hyangah
The text was updated successfully, but these errors were encountered: