biomejs/biome-vscode

๐Ÿ› Extension fails to find biome executable on Windows

Closed this issue ยท 5 comments

VS Code version

1.90.1

Extension version

2.3.0

Biome version

1.7.3

Operating system

  • Windows
  • macOS
  • Linux

Description

We have contributors that use Windows, Linux, and macOS with our monorepo. Windows users sometimes report that Biome's language server won't start and invariably the issue is it can't find the executable, or it finds the one that won't work on Windows (because Windows doesn't read/use shebangs) -- that is, biome instead of biome.CMD. The extensions lspBin setting would help, except it's not possible to set it in a cross-platform way in the VSCode workspace settings.

When Windows users set the lspBin to biome.CMD in their user settings, the extension is able to load it correctly. This is the CMD wrapper that npm creates on Windows automatically when installing deps with a bin field.

Steps to reproduce

See description.

Expected behavior

Ideally the extension would be able to find the correct executable per platform. Perhaps it isn't checking for the CMD wrapper on Windows? But even if that was resolved, it might be helpful to have a per-platform lsbBin setting. For example, lspBinWindows, lspBinLinux, etc. I don't care too much about the names or how they work, as long as there's a way to set an explicit path per platform. That way we could configure the workspace settings for everyone working in the repo regardless of platform.

Does this issue occur when using the CLI directly?

No

Logs

No response

As an add-on to @tylerbutler's suggestion, maybe something like biome.lspBin.windows, biome.lspBin.linux, etc, to align with what VSCode usually does:

image

When the extension looks for biome in the project's dependencies, it does attempt to locate the platform specific executable.

When you install @biomejs/biome, it should trigger the installation of a @biomejs/cli-[platform]-[arch] package.

  • What package manager do you use ?
  • Can you find the @biomejs/cli-win32-x64 package in your node_modules ?
  • Could you please share the contents of VS Code's OUTPUT tab for Biome ? It should tell us how the extension attempts to resolve Biome.

There's to note, that sometimes the package managers don't install optionalDependencies (due to some configuration/options).

Thanks a lot for looking into this!

When the extension looks for biome in the project's dependencies, it does attempt to locate the platform specific executable.

When you install @biomejs/biome, it should trigger the installation of a @biomejs/cli-[platform]-[arch] package.

  • What package manager do you use ?
  • Can you find the @biomejs/cli-win32-x64 package in your node_modules ?
  • Could you please share the contents of VS Code's OUTPUT tab for Biome ? It should tell us how the extension attempts to resolve Biome.

We use pnpm v8, and the per-platform packages are indeed installed in node_modules.

I should have mentioned that we set biome.searchInPath to false. We recently switched from prettier to biome, and the PR doing the switch was open for several months. We did initial testing with an earlier version of biome and the extension and setting it to false resolved something we noticed but I can't remember exactly what. But that may have been a mistake. Sorry I forgot to mention it earlier.

Anyway, we're only a couple of days into the switch and I think some of our problems may be on our side and will sort themselves out. I'll circle back early next week with some more details.

OK, now that we're a couple of weeks into our transition, it seems that the problems have gone away, so I will close this issue. Thanks!