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

Open
stamblerre opened this issue Jul 8, 2019 · 5 comments

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jul 8, 2019

@vincepri

This comment has been minimized.

Copy link

@vincepri 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

This comment has been minimized.

Copy link
Contributor Author

@stamblerre stamblerre commented Jul 8, 2019

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

This comment has been minimized.

Copy link

@vincepri 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

This comment has been minimized.

Copy link
Contributor Author

@stamblerre stamblerre commented Jul 8, 2019

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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 9, 2019

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

@gopherbot gopherbot added the Tools label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.