-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running Formatting + Code Actions on save generates duplicate imports #72
Comments
@rchl Is this an ST LSP bug perhaps? |
Server sends two code actions and we apply both of them which is causing the issue. Server doesn't specify "version" for each code action which would help avoid the issue because then only one would get applied. But yes, I would call it an LSP issue due to how "code actions on save" work, not being in line with how VSCode behaves. I've mentioned this discrepancy in sublimelsp/LSP#2421 (comment) (second paragraph). |
What do you recommend? "Fixing" it in LSP or creating an issue in ruff? |
Fixing in LSP. I believe I've mentioned this issue in at least two places so not sure now if there is some more relevant issue for tracking or whether we should create one. As for ruff, I would say an enhancement issue could be filed to include |
Hello!
I think, there must be some race condition when running formatting and fix all + organize imports code actions on save.
I've tried LSP-ruff before and did not notice such issue, so decided to create an issue.
Consider the following code (
app.py
):Here's my
LSP.sublime-settings
:I did not change
LSP-ruff.sublime-settings
:For the sake of this test, I disabled
LSP-pyright
globally and restarted my editor.When I hit
Ctrl+S
, this is the code I get:Notice the duplicate import of
msgspec
.I tried running lint + fix + format from CLI:
And the result seems to be fine:
Here's the LSP log:
Please, advise if I should create an issue in the ruff repository directly.
Thanks!
The text was updated successfully, but these errors were encountered: