biomejs/biome-vscode

๐Ÿ› Unable to save auto-formatting in VSCode

Closed this issue ยท 6 comments

VS Code version

1.90.1

Extension version

2.3.0

Biome version

1.8.3

Operating system

  • Windows
  • macOS
  • Linux

Description

When I press Command + S to save in VSCode, it does not format the file.

biome.json

{
  "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
  "organizeImports": {
    "enabled": true
  },
  "files": {
    "ignore": ["lib", "node_modules"]
  },
  "linter": {
    "enabled": true,
    "ignore": ["lib", "node_modules"],
    "include": ["packages/**"],
    "rules": {
      "style": {
        "noNonNullAssertion": "off"
      },
      "suspicious": {
        "noExplicitAny": "off",
        "noConfusingVoidType": "off"
      },
      "complexity": {
        "noStaticOnlyClass": "off"
      },
      "recommended": true
    }
  },
  "formatter": {
    "enabled": true,
    "attributePosition": "auto",
    "indentStyle": "space",
    "indentWidth": 2,
    "lineWidth": 80,
    "ignore": ["lib", "node_modules"],
    "lineEnding": "lf"
  },
  "javascript": {
    "formatter": {
      "arrowParentheses": "always",
      "bracketSameLine": false,
      "bracketSpacing": true,
      "quoteStyle": "single",
      "jsxQuoteStyle": "single",
      "quoteProperties": "asNeeded",
      "semicolons": "always",
      "trailingCommas": "all"
    },
    "parser": {
      "unsafeParameterDecoratorsEnabled": true
    }
  }
}

.vscode/settings.json

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

Steps to reproduce

  1. Command + S

Expected behavior

Format after saving

Does this issue occur when using the CLI directly?

No

Logs

Biome binary found at /Users/wangyi/vibe/nestjs-modules-repo/node_modules/.pnpm/@biomejs+cli-darwin-arm64@1.8.3/node_modules/@biomejs/cli-darwin-arm64/biome
Copying binary to temporary folder: file:///Users/wangyi/Library/Application%20Support/Code/User/workspaceStorage/111b475946637b58629d8b74394893e5/biomejs.biome/biome
Executing Biome from: /Users/wangyi/Library/Application Support/Code/User/workspaceStorage/111b475946637b58629d8b74394893e5/biomejs.biome/biome
[cli-stdout] data 66
[cli] exit 0
Connecting to "/Users/wangyi/Library/Caches/dev.biomejs.biome/biome-socket-1.8.3" ...
[Info  - 16:11:39] Server initialized with PID: 29379

Is the configuration file placed in the root of your repository?

Is the configuration file placed in the root of your repository?

Yes biome.json is placed in the root directory of my project

We'll need a reproduction at this point, would you mind creating one?

We'll need a reproduction at this point, would you mind creating one?

https://github.com/vibe-teams/nestjs-modules, pnpm Installation dependence.

@wangyi12358
Did you set "editor.formatOnSave": true in settings.json?
I confirmed that we can format code (on save) in the reproduction repo.

{
  "[typescript]": {
    "editor.defaultFormatter": "biomejs.biome",
    "editor.formatOnSave": true
  }
  ...
}

@wangyi12358 Did you set "editor.formatOnSave": true in settings.json? I confirmed that we can format code (on save) in the reproduction repo.

{
  "[typescript]": {
    "editor.defaultFormatter": "biomejs.biome",
    "editor.formatOnSave": true
  }
  ...
}

It should be due to missing this configuration. Thank you.