Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: prefer registering formatting provider dynamically #32989

Closed
stamblerre opened this issue Jul 8, 2019 · 6 comments
Closed

x/tools/gopls: prefer registering formatting provider dynamically #32989

stamblerre opened this issue Jul 8, 2019 · 6 comments
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.
Milestone

Comments

@stamblerre
Copy link
Contributor

Forked from microsoft/vscode-go#2446.

@gopherbot gopherbot added this to the Unreleased milestone Jul 8, 2019
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Jul 8, 2019
@stamblerre stamblerre added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 8, 2019
@vincepri
Copy link

vincepri commented Jul 8, 2019

Thanks for filing this @stamblerre, happy to contribute a patch if I can get more information on where this change should live

@stamblerre
Copy link
Contributor Author

Absolutely - that would be great! It would have to be in https://github.com/golang/tools/blob/master/internal/lsp/general.go - in the initialize and initialized functions, which correspond to the https://microsoft.github.io/language-server-protocol/specification#initialize and https://microsoft.github.io/language-server-protocol/specification#initialized requests. Basically, you'd have to check if the client supports dynamic configuration in initialize, and if so, do the dynamic configuration in initialized. Feel free to ask follow up questions if you need more clarification here.

@vincepri
Copy link

vincepri commented Jul 8, 2019

It seems there is already a check in initialized to register some capabilities dynamically https://github.com/golang/tools/blob/master/internal/lsp/general.go#L130. With regards to the formatter, how would I go about registering it dynamically?

@stamblerre
Copy link
Contributor Author

Yes, that's exactly the place to do it. It would look the same way, only you would be registering the textDocument/formatting capability.

vincepri added a commit to vincepri/tools that referenced this issue Jul 9, 2019
Fixes golang/go#32989

Signed-off-by: Vince Prignano <vince@vincepri.com>
vincepri added a commit to vincepri/tools that referenced this issue Jul 9, 2019
Fixes golang/go#32989

Signed-off-by: Vince Prignano <vince@vincepri.com>
@gopherbot
Copy link

Change https://golang.org/cl/185244 mentions this issue: internal/lsp: register textDocument/formatting provider dynamically

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
@stamblerre
Copy link
Contributor Author

Closing as discussed on the above CL.

@golang golang locked and limited conversation to collaborators Nov 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

No branches or pull requests

3 participants