-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
🐛 Biome doesn't format on save #238
Comments
Same here. But mine doesn't work even with "Format Document...". I have to run CLI (npx @biomejs/biome format --write ) to format the files correctly. And my Settings at VsCode are configured. "editor.formatOnSave": true, |
Can anyone who encounters this issue share a repo for reproduction / a screen record of the full editor window that shows the problem, and share the daemon logs when this issue happens? (You can run Otherwise it's difficult to debug. |
I dont have reproducible playground due to I don't know what is causing this, but well, here's daemon logs: https://hastebin.skyra.pw/eloyaxulaj.yaml Tried @heliocj 's workaround but they didn't work. One thing different is that I can format them correctly with biome cli |
The logs don't show any formatting request, which means it's possible you have some client setting which prevents from using Biome as default formatter. |
@ematipico I guess I set VSCode completely :( {
"editor.defaultFormatter": "biomejs.biome",
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
} |
Really weird. Can you share with us the repository, or a minimal reproduction? |
Yeah of course, I will make a minimal reproduction tomorrow |
@ematipico https://github.com/rikusen0335/biome-minimal-reproduction from CLI, I can format codes like by using:
But when Ctrl + S in VSCode, it doesn't format. |
@rikusen0335 Unfortunately, I cannot reproduce the issue with the provided repository. As @ematipico suggested, there may be a global setting in your VS Code profile that sets another tool as the default formatter for these files. You can try overriding this by creating a {
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
} |
@nhedger Okay, will try confirm my settings again and try that project specific settings. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
Now tried this:
But unfortunately it doesn't worked :( |
i have the same issue
I have installed the vscode extension, do I need to install Biome globally for it to work? |
Best way is to install it as part of your project's dependencies, but you can definitely install biome globally (e.g. using brew) and the extension will attempt to find it in the PATH. |
formatOnSave dont work for me if i use biomejs.biome |
You may want to provide a minimal reproduction repo. It's hard to tell without context. |
@Loscho19 In case lazy to create minimal reproduction: https://github.com/rikusen0335/biome-minimal-reproduction |
@nhedger So uh, can I get stcktraces for biome like when I press |
I have been having issues on two separate macs with biome format on save actions for the past 1-2 months. Before this, it was working a treat. Removing the files within The files removed included:
|
Here, daemon log:
|
tried this way, still doesn't work :( |
Looks at his log:
When applying the code actions, the LSP receives a range, and in that range, there aren't code actions to apply. I am not sure why, but that's information that comes from the client, so VSCode. |
Try to add this line, let's see if it helps: {
"editor.defaultFormatter": "biomejs.biome",
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"quickfix.biome": "explicit",
+ "source.fixAll.biome": "explicit",
"source.organizeImports.biome": "explicit"
},
} FYI, |
The line, which {
"[typescriptreact]": {
+ "editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome"
},
} Thank you for your support :) Note: {
"editor.codeActionsOnSave": {
"quickfix.biome": "always",
"source.organizeImports.biome": "always"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
}
}
|
Kind of off topic and a couple days too late but seeing all these configs around here I just though I'd share that this right here works so you don't have to add multiple lines with the same setting for each language: {
"[json][javascript][javascriptreact][typescript][typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
}
} |
Thanks, It's work for me. |
It should, AFAIK. Maybe it's overridden by something else |
@ematipico I find it ! "[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}, BUT! cmd + , does not show this configuration 😭 |
VS Code version
1.90.0
Extension version
2.3.0
Biome version
1.8.0
Operating system
Description
As title says, biome won't format codes in vscode when Ctrl + S.
Ctrl + Shift + P
>Format Document...
will correctly format.Steps to reproduce
Expected behavior
Biome will format codes when Ctrl + S
Does this issue occur when using the CLI directly?
Not sure / Not applicable
Logs
outputs from VS Code Biome
The text was updated successfully, but these errors were encountered: