Add supported commands in server capabilities#11850
Conversation
|
I think I'll re-order them to display the "printDebugInformation" at the end. Edit: Done |
12c9536 to
da841fc
Compare
|
| #[derive(Clone, Copy, Debug, PartialEq)] | ||
| pub(crate) enum SupportedCommand { | ||
| Debug, | ||
| Format, | ||
| FixAll, | ||
| OrganizeImports, | ||
| } |
There was a problem hiding this comment.
I renamed this from Command to SupportedCommand to match SupportedCodeAction and also moved it from the execute_command.rs module. Feel free to disagree on anything.
snowsignal
left a comment
There was a problem hiding this comment.
LGTM!
It's unfortunate that Helix isn't able to forward the URI for these commands - maybe that's something we should try contributing upstream eventually.
Yeah, we can start by opening an issue / discussion to let them know about this limitation. I also think this can be solved by a custom plugin but I don't think Helix supports them yet. |
Summary
This PR updates the server capabilities to include the commands that Ruff supports. This is similar to how there's a list of possible code actions supported by the server.
I noticed this when I was trying to find whether Helix supported workspace commands or not based on Jane's comment (#11831 (comment)) and I found the
:lsp-workspace-commandin the editor but it didn't show up anything in the picker.So, I looked at the implementation in Helix (https://github.com/helix-editor/helix/blob/9c479e6d2de3bca9dec304f9182cee2b1c0ad766/helix-term/src/commands/typed.rs#L1372-L1384) which made me realize that Ruff doesn't provide this in its capabilities. Currently, this does require
ruffto be first in the list of language servers in the user config but that should be resolved by helix-editor/helix#10176. So, the following config should work:Test Plan
:lsp-workspace-commandis invoked: