biome-vscode: Extension 'Biome' is configured as formatter but it cannot format 'JavaScript'-Files

When i click configure, no biome is in the list.

I created a fresh new example project:

Installed Biome v2.0.0 in VSCode.

Added settings.json

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

/example.code.workspace

{
  "folders": [
    {
      "path": "biome-test"
    }
  ]
}

/biome-test/package.json

{
  "name": "biome-test",
  "version": "1.0.0",
  "main": "index.js",
  "devDependencies": {
    "@biomejs/biome": "^1.4.1"
  }
}

/biome-test/biome.json (from biome-hompeage

{
  "$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
  "organizeImports": {
    "enabled": false
  },
  "linter": {
    "enabled": true,
    "rules": {
      "recommended": true
    }
  }
}

/biome-test/index.js

console.log("Hello World!") // without semicolon so `biome check index.js` errors in cli

Restart everything, vscode has no biome.

In command line i can execute:

cd biome-test
./node_modules/.bin/biome check index.js

It shows Checked 1 file(s) in 1031µs Found 2 error(s)

Adding /biome/test/biome.json

  "javascript": {
    "formatter": {
      "semicolons": "asNeeded"
    }
  }

Re-run and it shows Checked 1 file(s) in 932µs

So biome cli works and uses biome.json.

But not in VSCode. Tried nightly too, the same, no biome detected.

VSCode 1.84.2 Biome v2.0.0 Node v18.19.0 Linux Mint 21.2 (Ubuntu jammy)

Let me know, if i can provide more informations.

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Reactions: 3
  • Comments: 18 (5 by maintainers)

Most upvoted comments

@nhedger I have created a reproduction repository https://github.com/gabberr/vscode-biome-issue/

EDIT: Sorry, looks like I miss configured lspBin path here. Rechecking…

I had the same outcome as @gabberr when testing this out for our monorepo last week, and was confused, since the CI works great with that setup. (and you def. don’t want a situation where editor and CI is out of sync)

Is there anything missing in the repro https://github.com/biomejs/biome-vscode/issues/25#issuecomment-1862517467 or something I can try/add to help out? The issue this has the Needs reproduction label.

I was sure we were able to handle unsaved files.

@ematipico Are you suggesting that the steps I posted should result in a successful format instead of seeing the following error message?

Exactly 💯

Extension ‘Biome’ is configured as formatter but it cannot format ‘TypeScript’-files

If yes, should I open a separate issue in this repository with the content of my original comment?

Please open an issue in the main repository. Also, provide the daemon logs by using biome rage --daemon-logs.

It could be very long, so make sure to extract the logs emitted when attempt the formatting.