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

Support dynamic capabilities #372

Closed
ehuss opened this issue Jul 6, 2018 · 5 comments
Closed

Support dynamic capabilities #372

ehuss opened this issue Jul 6, 2018 · 5 comments

Comments

@ehuss
Copy link
Contributor

ehuss commented Jul 6, 2018

Some servers rely on the client/registerCapability message to enable features dynamically. It would be nice if the plugin supported this.

In my particular use case, RLS (rust) needs this to support range formatting. The initialization indicates it is initially not supported, and it is not turned on until didChangeConfiguration is sent with certain settings, after which it sends a registerCapability to indicate that range formatting is now enabled.

@tomv564
Copy link
Contributor

tomv564 commented Jul 11, 2018

This is definitely a major mechanism LSP is missing, I'd like to understand it a bit more.

I see the benefit of capability registration for server-initiated behaviour.
But from RLS's perspective, why is range formatting not always available?

@ehuss
Copy link
Contributor Author

ehuss commented Jul 12, 2018

I believe they want it to be an explicit opt-in feature where it is disabled by default because it is in an experimental state.

@AmjadHD
Copy link
Contributor

AmjadHD commented Oct 17, 2019

Vscode-json-languageserver requires dynamic capability registration to support range formatting:

Formatting support requires the client to support dynamicRegistration for rangeFormatting. If not supported by the client, the server will not offer the format capability.

@tomv564
Copy link
Contributor

tomv564 commented Oct 17, 2019

Ah good, another example:

(working link: https://github.com/vscode-langservers/vscode-json-languageserver/blob/f959652da2a7bb8b80303fcd02702d4d01ee280b/src/jsonServerMain.ts)

In this case the server wants to check client-sent settings before enabling a capability, and that cannot be done while replying to "initialize".

The Metals server uses it with the "documentSelector" parameter for the watched files API, that also makes sense.

Perhaps we can pick some of these capabilities to be not statically enabled.

@rwols
Copy link
Member

rwols commented May 4, 2020

This is in master now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants