python-lsp/python-lsp-ruff

Wrong code action range for sort import action

fast-90 opened this issue · 3 comments

When I try to "Organize imports" via code actions, I observe the following unexpected behaviour:

Before organizing imports:
image

After organizing import with python-lsp-ruff:
image

Expected behaviour (below screenshot is obtained by using code actions with ruff-lsp):
image

As you can see, a random i is inserted at the beginning, and the c from the class statement disappeared.

Performing the code action with ruff-lsp and running ruff --fix file.py --extendSelect "I" on the command line provide the expected result.

For reference, I am on WSL Ubuntu using Emacs (29) with eglot.

Not sure if this an issue something with Emacs/eglot or my setup, but as I don't have the issue with ruff-lsp I thought it might be worth checking here if anyone else has the same issue?

This issue should be fixed in the latest version of python-lsp-ruff (or v1.5.0), can you update and check again?

This issue should be fixed in the latest version of python-lsp-ruff (or v1.5.0), can you update and check again?

Ah should have checked for recent updates! I can confirm I no longer have this issue. Thanks for the swift reply, and thanks for this awesome tool :)

No problem:)