-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
🐛 Multiple entries in the list of formatters #1584
Comments
Hey, Thanks for opening this issue. Could you provide a reproduction? |
Hi there! What do you need for a "reproduction"? Do you mean like a list of info about the environment it's running in, or do you mean like a hosted vscode instance showing the bug? |
Sorry, should have been more clear. ideally a repo that contains a dev container in which you install the extension. I’d like to try and reproduce the behaviour. thanks |
Hi @nhedger and I think this is very similar with my case. I don't use VSCode DevContainer. I'm just try to use Biome as a formatter via extensions and sometimes biome's formating is strange. I guess each extension instances are trying format. Here is my vscode information:
Biome Extension version is v2.1.1. IMO, I think it cannot produce a reproduction sample because it is not related with user's workspace. but if you need any information, I'm ready to respond :) |
Same issue here with extension version 2.1.1
|
In version 1.2.2, apparently the extension only has one entry. All versions more recent than this one have this problem, but I couldn't test it on versions 1.4.x, because it was giving an error. |
This issue might lie with the underlying biome binary, and not with the VS Code extension. I've successfully reproduced the issue where multiple formatters are shown in the "Format document with..." action. In my tests, I've used the latest Biome VS Code extension (2.1.1). ReproductionTo reproduce, I've ran the tests against the codebase of the extension:
Biome CLI (
|
I've just noticed it too in a VS Code window I've had open the entire day now. There's 3 Biome entries in my I am absolutely positive that when I checked earlier today there was only a single entry. So I suspect there is some event that may happen that will trigger additional entries to appear. Could it have been a server crash? |
I'm almost positive this was introduced by #1104. Also, the extension does not register a formatting provider itself. |
What happens if you reload the window ? |
It reverted to having only 1. |
So if it's the daemon doing the registering, couldn't a crash explain the behavior? Since it will get restarted and the new instance will register itself too? But then the question is, who is responsible for cleaning up crashed instances? They can't do that themselves... |
I'd have to do more tests. I immediately see two entries when the extension starts. |
Apologies for the late reply. Here's my
|
Just now I had again 3 formatter entries, and one thing I do notice is that I sometimes I also get a message from VS Code saying it cannot connect to the Biome daemon. It's not often, and when it happened earlier today I checked and there was still only one formatter entry. But just now it happened again, and then there were three. I cannot say it's the cause, but it is something suspicious. I can see the following extension log inside VS Code:
As you can see the server does seem to restart every now and then, though the log doesn't say why unfortunately. |
@arendjr the client reloads when a change is detected in a lockfile. We do this to handle the user updating the |
Hmm, so I just tried |
I think the issue may be related to where we create the socket. It's the only change related to the VSCode extension and the LSP that I could think of: #1238 |
As suspected, reverting #1104 fixes it for me. I'm yet to investigate why exactly that happens. |
Maybe both dynamic and static registrations go in conflict? |
That would be my guess, too. |
Alright, so using the advertised client capabilities, I've conditionally registered the providers statically. I'll send a PR. |
We just published a nightly with a possible fix: https://github.com/biomejs/biome/releases/tag/cli/v1.5.2-nightly.91c7730 It would be great if someone can try it, and let us know. |
I still have it in v.1.8.3, and I think I had it all along this year, is there anything else that can be done? |
OP and other people haven't replied in long time, so we assumed everything was fixed. I suggest you to create a new issue with a reproduction, and we can look into it. |
I have the same problem in the 1.8.4 nightly build (and earlier versions too). I don't know under what conditions it occurs. This issue causes the code to become corrupted when auto-saving in VSCode. Sometimes it breaks the import statements, sometimes it breaks the middle of the code, etc. However, whenever this problem occurs, there are "always" multiple formatter instances running. (It seems like a conflict between multiple biome extension clients.) My running environment is Windows 11 Pro (23H2) and my biome settings are:
|
I am still experiencing this issue. Using Biome 1.8.3 and VS Code extension (v2.3.0) if it helps. It occurs very unexpectedly (which I find it hard to reproduce) and get fixed after completely exit VS Code and open again. |
I have Dev Containers in my VS Code extension, and the problem disappeared after I uninstalled it. But I'm not sure why. |
what happened
what is expected
Biome VSCode extension should only appear once in the list of formatters and should not increase every time the devcontainer is rebuilt.
The text was updated successfully, but these errors were encountered: