biome-vscode: šŸ› Extension does not find the biome binary if it depends on the CWD

VS Code version

1.96.2

Extension version

2.3.2

Biome version

1.9.4

Operating system

  • Windows
  • macOS
  • Linux

Description

Our project is managing the version of Biome through mise. This means, that the biome version is specified per project. This means, that biome is not available when running from the home folder but from the project folder:

# From ~:
āÆ which biome
biome not found

# From the project
āÆ which biome
~/.local/share/mise/installs/biome/1.9.5-nightly.ff02a0b/biome

The extension is not able to recognize this properly and instead it reports that the biome binary could not be found. With the latest pre-release it does not even warn the user about the fact that biome is missing.

Note, that this works as expected if VSCode ist started from the project folder from the terminal (where biome is available).

Steps to reproduce

  1. Use mise to install biome per folder
  2. Start VSCode from outside that folder (e.g. through Launchpad)

Expected behavior

The extension should be able to find the biome binary based on the path it’s operating in.

Does this issue occur when using the CLI directly?

No

Link to a minimal reproduction

No response

Logs

2025-03-13 12:02:00.557 [info] 





2025-03-13 12:02:00.557 [info] Biome extension 2025.2.72227 activated
2025-03-13 12:02:06.397 [error] Could not find the Biome binary
2025-03-13 12:02:06.397 [error] Failed to create session for project.
	project=<REDACTED>
2025-03-13 12:02:06.397 [info] Biome extension started
2025-03-13 12:02:06.398 [info] User-facing commands registered
2025-03-13 12:02:06.398 [info] Started listening for lockfile changes
2025-03-13 12:02:06.398 [info] Started listening for configuration changes
2025-03-13 12:02:06.398 [info] Started listening for active text editor changes

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 18 (7 by maintainers)

Most upvoted comments

From here, we can make a conclusion that currently findBiomeInPath() is not workspace aware. (Well… / is obviously not the workspace directory.)

The findBiomeInPath method was never intended to be workspace-aware. It’s meant to locate a globally installed Biome instance on your system. The reason we call it in findBiomeForWorkspaceFolder is to gracefully fallback to that global installation in the event we don’t find one installed in your dev deps.

I think, that the current findBiomeInPath() logic could be replaced with the result of spawning biome __where_am_i with cwd set to the workspace directory.

This wouldn’t work for versions prior to Biome v2, because that’s when we introduced this command, but we could introduce some logic to check for that and use the current behavior in that case.


That said, I’m yet to understand how mise works under the hood.

As mentioned before, if someone is willing to send a PR that adds support for this without breaking the existing logic, I’m all for it.

Regardless, we don’t know the tool and how it works, so maybe someone who knows it should help and send a PR to fix it.

@nhedger @ematipico To come back to the mise question. Why not to obtain the binary path by executing which biome with cwd set to current workspace root. That can be a fall back check, for instance. This could work, or? As explained in https://github.com/biomejs/biome-vscode/issues/528#issuecomment-2836039336

ok. it turns out the doc is super misleading for windows situation as it implies downloading the published binary, including manually looking up the latest CLI version, and yet adding it into the sysyem env variable after downloading…

the fix is just running: npm install -g @biomejs/biome@latset from anywhere in the cli.

The annoying install biome globally notification is finally resolved!

Image

Image

ā€œPlease install Biome globally on your system so the extension can start a global LSP session for files that are not part of any workspace.ā€

I’m not sure what I can do for this regularly happening to me on windows, even though I have followed the documentation to intall the binary ā€œmanuallyā€ using https://biomejs.dev/guides/manual-installation/#using-a-published-binary.

Do I have to also manually add the Biome into the PATH? Anyone knows how?