-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
workspace/executeCommand not supported #1232
Comments
Yeah, right, We need microsoft/language-server-protocol#724 to switch to build-in facilities for our code actions |
The "rust-analyzer"[0] language server requires the clients to implement a custom source change operation. This is similar to the already existing "java.apply.workspaceEdit" functionality in this language client. This feature can be removed once rust-analyzer supports server-side file manipulation[1]. [0]: https://github.com/rust-analyzer/rust-analyzer [1]: rust-lang/rust-analyzer#1232
Would it be better to move |
@kjeremy we can't do that because, because:
Ideally, we extend LSP with support for those use-cases, yeah. |
When adding support for this in Vim, I noticed that the client already had something similar implemented for the/a Java language server. So apparently it's not unprecedented to leave it up to the clients to handle this (probably for the same reasons you mentioned, @matklad, the LSP spec does not provide the flexibility needed in this case). |
The "rust-analyzer"[0] language server requires the clients to implement a custom source change operation. This is similar to the already existing "java.apply.workspaceEdit" functionality in this language client. This feature can be removed once rust-analyzer supports server-side file manipulation[1]. [0]: https://github.com/rust-analyzer/rust-analyzer [1]: rust-lang/rust-analyzer#1232
This can be closed, I think? |
right, we don't intend to have server-side commands. |
Do I understand this right, that this is a custom implementation needed in every client? I'm coming from Neovim and basically can't use any of the code lenses (Run Test, Debug...) because it's considered a "custom extension/handler" (neovim/neovim#14874 (comment)) and it needs custom implementation. If that's true then it's quite sad and we are again at a point pre-LSP where each editor needs to provide custom code to fully support some features (albeit much less then before). |
@jan-xyz you need https://github.com/simrat39/rust-tools.nvim to gain access to rust-analyzer specific extensions in neovim. If you want to see our extensions upstreamed into the protocol, show your support for corresponding issues on the lsp repo: https://github.com/microsoft/language-server-protocol/issues/created_by/matklad |
Thanks for your reply, I played around with rust-tools and it covers at least some aspect ( I can run individual tests 🤗 ) but the code lenses aren't implemented, I guess I vote and hope that Microsoft will hear our plea... |
If this is about this functionality: then the situation here is even more confusing. What we do here is entirely standard LSP, but still requires custom support from the client. Basically, in the LSP code lens contains a string name of the command to be executed by the client (like This particular feature really should have first-class support in the protocol, upstream issue is microsoft/language-server-protocol#944 |
Yes! That's the functionality, did I comment on the wrong issue? Since Neovim invokes So what a plugin like |
Aha, my understanding is that shouldn't be happening, opened neovim/neovim#15183 for that. |
The lsp-features.md file mentions that
workspace/executeCommand
is supported (specifically,apply_code_action
):https://github.com/rust-analyzer/rust-analyzer/blob/a71d0ecd774008bbfe8cb2215ffa6dedd5024877/docs/dev/lsp-features.md#L19-L20
I want to make rust-analyzer code actions work in Vim by updating LanguageClient-neovim, but from what I can tell,
workspace/executeCommand
is not actually supported anymore?I can see the
handle_execute_command
handler being removed in 8abf536#diff-43d4f175343e385858e9f5a752c17d57L370.Instead, from what I understand, I have to do a
textDocument/codeAction
request, pick one of the actions to perform, match on therust-analyzer.applySourceChange
command, and then parse thearguments
data to apply the changes locally on the client:https://github.com/rust-analyzer/rust-analyzer/blob/a71d0ecd774008bbfe8cb2215ffa6dedd5024877/crates/ra_lsp_server/src/main_loop/handlers.rs#L630-L633
Are my assumptions correct? If so, then I'll start adding this feature to Vim, and I guess it would make sense to uncheck the box in the supported features list, right?
The text was updated successfully, but these errors were encountered: