Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

settings: create one setting to specify an alternate language server #3028

Closed
stamblerre opened this issue Feb 4, 2020 · 5 comments · Fixed by #3127
Closed

settings: create one setting to specify an alternate language server #3028

stamblerre opened this issue Feb 4, 2020 · 5 comments · Fixed by #3127
Labels
needs-decision Feedback is required from experts, contributors, and/or the community before a change can be made.

Comments

@stamblerre
Copy link
Contributor

Right now, users can specify alternative tools for VS Code Go to use through the go.alternateTools setting. Both "gopls" and "go-langserver" can be replaced, which makes for a confusing user experience. What is the expected behavior if both of these are configured?

I propose that we create one setting for the language server specifically, something like:

"go.alternateTools": {
    "language-server": "gopls"
}

Where "gopls" might be the default, "go-langserver" is another option, and any other text is also allowed.

@ramya-rao-a, @hyangah: What do you think?

@hyangah
Copy link
Contributor

hyangah commented Feb 4, 2020

+1 for refactoring.

I wonder if go.useLanguageServer should be enum instead of a bool.

go.alternateTools can be used to specify a wrapper script or an absolute path to the corresponding binary (for example, you can utilize this to test or ensure the use of a different version of gopls without uninstalling or installing the gopls binary from the PATH) so depending on go.alternateTools['...'] to be gopls and go-langserver should be done carefully.

@ramya-rao-a
Copy link
Contributor

Both "gopls" and "go-langserver" can be replaced, which makes for a confusing user experience. What is the expected behavior if both of these are configured?

Today, if the "alternate tool" set for gopls exists, then that takes precedence over the alternate tool set for go-langserver.

We are well beyond the point of supporting go-langserver. It was supported in the absence of gopls during a time when we were making the transition to using gopls. I am ok removing the support for go-langserver. If users still want to use it, they can always map gopls to go-langserver.

Regarding using something generic language-server as the "key" in go.alternateTools, I don't believe that gives us a lot of benefits for the amount of overhead supporting it would add

@ramya-rao-a
Copy link
Contributor

I wonder if go.useLanguageServer should be enum instead of a bool.

What would the enum support?

@stamblerre
Copy link
Contributor Author

I agree that adding an enum might encourage users to try go-langserver, which we shouldn't do. I think that my PR (#3029) will achieve what we want for now, which is to only run go-langserver if the user sets it as an alternate tool for gopls. I didn't make the change to using the generic "language-server" configuration, so I am fine leaving it as is.

@hyangah
Copy link
Contributor

hyangah commented Feb 5, 2020

@ramya-rao-a

I wonder if go.useLanguageServer should be enum instead of a bool.

That was based on the assumption that there is still interest or good use of go-langserver instead of gopls. In the current code, the choice of the language server is implicit so I thought the enum like the lint option would be more explicit. However, it seems the assumption is no longer true.

@stamblerre stamblerre added needs-decision Feedback is required from experts, contributors, and/or the community before a change can be made. and removed under-discussion labels Feb 11, 2020
gopherbot pushed a commit to golang/vscode-go that referenced this issue Mar 11, 2020
Remove the code that handled this in the language server installation, and be careful to only install the tool specified by the user. Also, remove some unused import lines in the goLanguageServer.ts file.

Fixes microsoft/vscode-go#3028.

Change-Id: I813c39f7d4997b63f7a87c1551de23df2808259c
GitHub-Last-Rev: 9aa7363
GitHub-Pull-Request: #2
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/222417
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
@vscodebot vscodebot bot locked and limited conversation to collaborators May 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-decision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
3 participants