Closed xl4624 closed 6 months ago
Interesting find! It's because both ruff_lsp
and ruff server
sends the diagnostics with the same name "Ruff". So, when you invoke code actions, Neovim sends all (from both ruff server
and ruff_lsp
) the diagnostics on the cursor line to all the servers (both ruff server
and ruff_lsp
). But, the structure of diagnostic expected by ruff server
and ruff_lsp
is different which is why you're getting a key error.
It's not recommended to use ruff-lsp
and the new server at the same time. I think we should make this clear in the documentation if it's not mentioned.
Ok, it's at least mentioned for the Neovim setup guide: https://github.com/astral-sh/ruff/blob/main/crates/ruff_server/docs/setup/NEOVIM.md
And I don't think it's possible to even run both ruff_lsp
and ruff server
in VS Code at the same time because they both are available exclusively in the stable and pre-release version of the extension. Even in pre-release one can only enable either one of the server.
I'll close this issue as it's not recommended to run both the server at the same time.
cc @snowsignal
Makes sense. Not even sure what compelled me to install ruff_lsp
to be honest, I probably installed it by accident one day and just ran with it.
Thanks for the response!
When I run neovim with this config:
And then wait a bit for ruff to load in, when I try
<space>ca
on this test file:I get "No code actions available"
Here are the relevant logs:
I'm using
ruff 0.4.2
andruff-lsp 0.0.53
installed with Mason. It works fine if you disable one or the other so probably not a big deal 😅