biomejs/biome-vscode

"editor.formatOnSave": true does not respect "files": { "ignore": ["example.ts"] },๐Ÿ›

Closed this issue ยท 10 comments

VS Code version

1.87.2

Extension version

2.2.2

Biome version

1.5.3

Operating system

  • Windows
  • macOS
  • Linux

Description

If 'format on save' is turned on, the Biome.js extension will format files that should be ignored.

Steps to reproduce

Follow the Biome.js docs and add an ignore rule to your biome.json file.

biome.json

{
  "files": {
    "ignore": ["scripts/*.js"]
  }
}

2 - Edit your vscode settings to turn on 'format on save'. With this turned on, formatting should be performed any time you save a file.

vscode setting file

"settings": {
    "editor.formatOnSave": true,
}

3 - Add some JavaScript files to /scripts
4 - Make some edits and save the file
The files are formatted even though they are in the ignore list.

Expected behavior

If you run biome.js in the terminal, e.g. pnpm run lint the files are NOT formatted. This is how I think the extension should work, too.

Does this issue occur when using the CLI directly?

No

Logs

No response

I found this closed issue which appears to be an duplicate, but I just tried this out on the pre-release version and can still reproduce my issue.

v2024.3.70509 (pre-release)

I know this is a Biome.js extension issue because it goes away if I disable/uninstall the extension.

The latest version of biome (not the extension) is 1.6.3 (and 1.6.4 soon), could you try the latest one?

@Sec-ant that fixed it. Should have thought of that!

1.6.3 Biome.js version resolves the issue.

I'm having the same issue with formatter using version 1.7.0.

Same here.

Extension 2.2.2
Biome 1.7.2

@Sec-ant guess you could reopen this? If you need any more info or a reproducable example let me know.

Can anyone create a small reproduction?

Can anyone create a small reproduction?

Yes, I will do now.

@Sec-ant @ematipico @vktrl after investigating I opened a new issue with reproduction example, since my is related to formatter.ignore.

Can anyone create a small reproduction?

https://github.com/vktrl/biome-vscode-ignore-bug