Skip to content
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

Open
1 of 3 tasks
rikusen0335 opened this issue Jun 12, 2024 · 9 comments
Open
1 of 3 tasks

🐛 Biome doesn't format on save #238

rikusen0335 opened this issue Jun 12, 2024 · 9 comments
Labels

Comments

@rikusen0335
Copy link

rikusen0335 commented Jun 12, 2024

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

  1. 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\@[email protected]\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
@heliocj
Copy link

heliocj commented Jun 19, 2024

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,
"editor.defaultFormatter": "biomejs.biome",

@Sec-ant
Copy link
Member

Sec-ant commented Jun 19, 2024

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 biome clean to clear the existing logs before starting logging)

Otherwise it's difficult to debug.

@heliocj
Copy link

heliocj commented Jun 19, 2024

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):
configs

@rikusen0335
Copy link
Author

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

@ematipico
Copy link
Member

I dont have reproducible playground due to I don't know what is causing this, but well, here's daemon logs: 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.

@rikusen0335
Copy link
Author

@ematipico I guess I set VSCode completely :(
Here is the config:

{
  "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"
  },
}

@ematipico
Copy link
Member

Really weird. Can you share with us the repository, or a minimal reproduction?

@rikusen0335
Copy link
Author

Yeah of course, I will make a minimal reproduction tomorrow

@rikusen0335
Copy link
Author

rikusen0335 commented Jun 22, 2024

@ematipico https://github.com/rikusen0335/biome-minimal-reproduction
Now TOMORROW, here's minimal repro.
Just kidding sorry for late :(

from CLI, I can format codes like by using:

 W:\biome-minimal-production
❯ pnpm biome format --write .\src\app\layout.tsx

But when Ctrl + S in VSCode, it doesn't format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants