How do I run an arbitrary rust-analyzer action in any editor that is not VS Code?

I'd like to invoke, for example, the Join Lines action with Neovim's built-in LSP. How would I go about that? The documentation mentions the "Action name" but when I try and list code actions via textDocument/codeAction, it is never listed. I also tried using the workspace/executeCommand request, but rust-analyzer appears to lack the relevant capability ("method workspace/executeCommand is not supported by any of the servers registered for t
he current buffer").

Join Lines is a protocol extension, so it requires client support beyond the standard LSP features.

1 Like

Yeah, after reading that, I realized that all the "actions" I cared about were implemented as protocol extensions, and that the commands list is pretty much a VSCode thing.

Thank you for putting me on the right path! :slight_smile:

you could do that in Vim without any plugin: in the line of data in normal mode: 6J do the same action

You need rust-tools nvim plugin: GitHub - simrat39/rust-tools.nvim: Tools for better development in rust using neovim's builtin lsp

1 Like