python-lsp/python-lsp-ruff

python-lsp-ruff does not act like ruff-lsp (at least in neovim)

bluthej opened this issue ยท 3 comments

I currently use ruff-lsp inside of neovim and I decided to install python-lsp-server in addition to get all the nice lsp stuff like 'go to definition' and such. I tried using python-lsp-ruff instead of ruff-lsp because I thought it made more sense to have everything in one language server, but I was sad to find it does not act the same as ruff-lsp. Is that normal?

The main pain points for me are:

  1. Some things that are displayed as warnings by ruff-lsp are displayed as errors by python-lsp-ruff, e.g. unused imports or Redefinition of unused...
  2. I don't have any code actions, whereas with ruff-lsp I have things like organize imports

I am not entirely sure if that's a neovim thing or if that's a python-lsp-ruff thing, but I thought I would post it here first, feel free to redirect me if this is out of your hands ๐Ÿ™‚

BTW, I tried two different methods to install python-lsp-ruff, both yielded the same outcome. The first one was a direct pip install, the second one was through Mason using the :PylspInstall command I discovered in this issue.

Some things that are displayed as warnings by ruff-lsp are displayed as errors...

Adding severities is an ongoing issue on ruff, see astral-sh/ruff#1256. In ruff-lsp a selected number of error codes is shown as "error", the rest is displayed as "warnings" (see this code snippet).
I am hesitant to add this "hardcoded" severity as this will lead to disagreement in what to treat as an error and what to treat as a warning (see for example this issue, also here). I think the best move would be to wait for ruff to add severity codes when linting and expose these to the editor rather than creating our own list of codes.

I don't have any code actions

Yes, code actions have not been implemented yet, see #3. I didn't have the time/motivation to start on that so far.

Does that answer your questions?

Yes thank you! I just wanted to make sure I wasn't doing anything wrong.

I realize all of this takes a lot of time and energy to implement, I hope you didn't take my remarks as criticism! Thank you for sharing this kind of stuff with everybody ๐Ÿ™

Not at all, thanks for your interest in the project :) feedback is always nice to have, it might even give me enough motivation to work out the Code actions soon.