-
-
Notifications
You must be signed in to change notification settings - Fork 498
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 code actions on save breaks imports #4680
Comments
Closing as duplicate of biomejs/biome-vscode#229 |
@nhedger biomejs/biome-vscode#229 seems to focus on performance, however my issue above also describes an issue with imports breaking. Can we re-open this and update the title? I can still reproduce this issue on the last version (1.9.4): https://github.com/OliverJAsh/biome-vscode-quickfix-import-issue/tree/1.9.4 |
Sure, but in that case it belongs in the main repo. I'll move it |
@OliverJAsh is it possible that there are multiple processes running? Try to check the task manager, or use If so, kill the processes. This happens with the old version of the VSCode extension |
Thanks for the reply @ematipico. It doesn't seem like that's the case. I can only see one running server. I can also reproduce this issue after restarting my entire system, with no windows/applications open except for the reduced test case I shared. Are you able to reproduce it using my test case? |
Yeah, I can consistently replicate the issue. However, this issue doesn't occur with other clients such as Zed. |
I wonder if it's related to biomejs/biome-vscode#229, because the corruption only seems to happen after the delay. |
I think so. On my machine I can see that VSCode applies the changes with a delay between the two of them, in fact if I use CTRL+Z, I can see states of the code I didn't have before. I need to hit 2/3 times before reverting the code to how it was. I am mostly certain that this is a VSCode issue, which isn't able to batch the changes in a single one, and instead it queues them and eventually emits incorrect code. |
This doesn't seem to be an issue when using |
@OliverJAsh can you close the issue? |
Sure, but I think the documentation still needs to be updated to mention the new command. |
VS Code version
1.89.0
Extension version
2.2.2
Biome version
1.7.3
Operating system
Description
When
noUnusedImports
is enabled, running code actions on save (source.organizeImports.biome
+quickfix.biome
) is slow and breaks the imports.Steps to reproduce
Full reduced test case: https://github.com/OliverJAsh/biome-vscode-quickfix-import-issue/compare/1.7.3. Contents inlined below.
Given:
biome.json
:.vscode/settings.json
:index.ts
:When I save
index.ts
and "code actions on save" runs, I notice two things. Firstly, it feels much slower than I would expect it to be. It adds about 500ms-1s to the save operation (see screen recording below). Secondly, I end up with broken imports—this is similar to biomejs/biome-vscode#179 although note here I'm using the latest version of Biome which—I understand from https://github.com/biomejs/biome/issues/688—is supposed to include the fix.Screen.Recording.2024-05-09.at.09.51.16.mov
Expected behavior
Save is fast + imports are not broken.
Does this issue occur when using the CLI directly?
Not sure / Not applicable
Logs
No response
The text was updated successfully, but these errors were encountered: