biome-vscode: š Biome doesn't format on save
VS Code version
1.90.0
Extension version
2.3.0
Biome version
1.8.0
Operating system
- Windows
- macOS
- Linux
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
- Just Ctrl + S
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
Biome binary found at s:\workspace\konomi-hp\node_modules\.pnpm\@biomejs+cli-win32-x64@1.8.0\node_modules\@biomejs\cli-win32-x64\biome.exe
Copying binary to temporary folder: file:///c%3A/Users/rikusen/AppData/Roaming/Code/User/workspaceStorage/a651e6ef88d0cffc954257946c90e77a/biomejs.biome/biome.exe
Executing Biome from: c:\Users\rikusen\AppData\Roaming\Code\User\workspaceStorage\a651e6ef88d0cffc954257946c90e77a\biomejs.biome\biome.exe
[cli-stdout] data 29
[cli] exit 0
Connecting to "\\.\pipe\biome-service-1.8.0" ...
[Info - 21:10:29] Server initialized with PID: 35248
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 9
- Comments: 40 (9 by maintainers)
@ematipico I guess I set VSCode completely š¦ Here is the config:
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:
Woot! After some hours trying everything around, in my case, I just found some options that after deactivated them, my Biome just back to work like a charm.
Iāll let this information here if someone having the same issue at windows.
I just migrated those eslint+prettier configurations to Biome json file and deactivated these two options in my VsCode settings (those both were activated for some reason):
Same here. But mine doesnāt work even with āFormat Documentā¦ā. I have to run CLI (npx @biomejs/biome format --write <files>) to format the files correctly. And my Settings at VsCode are configured.
āeditor.formatOnSaveā: true, āeditor.defaultFormatterā: ābiomejs.biomeā,
I think I figured out why this is happening. The issue lies in how language selectors are implemented differently between formatters:
Prettierās VSCode extension has special handling for comma-separated language selectors in settings.json, automatically splitting them into separate configurations internally. For example, this works with Prettier:
However, Biome strictly follows VSCodeās native language selector syntax, which requires separate configuration blocks for each language. The correct way for Biome would be:
It is ānot a bugā, but I wonder if Biome also adopt comma version of language selector can make configuration a bit less painful?
@ematipico I find it ! Because there is in settings.jsonļ¼
BUT! cmd + , does not show this configuration š This should be a vscode bug.
@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
.vscode/settings.jsonfile with the following contents:Just to add my solution to this. I had to pull up the settings.json (not the UI but the actual json file) and do a text search for all instances of
editor.defaultFormatterfor the related languages and remove them. Seems like they arenāt removed when prettier is uninstalled.I did all of those things, as well as manually write the settings in json file. Then I started using Deno, and it already has its own formatter built in, but it also refused to format when saving the document, until I completely removed the Biome extension from VS Code.
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
/Users/<UserName>/Library/Caches/dev.biomejs.biomeas mentioned on https://biomejs.dev/guides/integrate-in-editor/#daemon-logs resolved my issue.The files removed included:
Yeah of course, I will make a minimal reproduction tomorrow