biome-zed: Disable Biome LSP if `biome.json` or `@biomejs/biome` package is not found.

Currently, if a project doesn’t have a biome.json or does have a @biomejs/biome package installed, the extension will download a separate biome binary instead. However, it’s not friendly for projects that are yet to migrate to the biome.

It would be good if the biome LSP enable when either biome.json or @biomejs/biome is found (or maybe both).

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 23 (15 by maintainers)

Most upvoted comments

Hmm I guess the extension doesn’t find the binary for some reason…

I think it only checks the existence of the binary relatively somewhere in the Zed extension directory. I was wondering if we could utilize the worktree, similar (but not the same) to how the zig extension did. https://github.com/zed-industries/zed/blob/2c78cf349b94d69a4b027400d9d388992a4e4517/extensions/zig/src/zig.rs#L21

FYI if you build zed from source and run with cargo, you do get logs like this: image and println’s too… which is why I thought logs work 😃

I actually did try to disable the cached_server_path part, and it’s the same, likely the langague_server_command() doesn’t even get called twice.

So turns out the language_server_command() does get called again every time we open a new workspace, and I manage to get the extension to use the workspace binary instead, the lack of logging ready confused me a lot😵‍💫

Will put up the PR once I cleanup the implementation.

In my case, the language server doesn’t use the biome.json configuration in my monorepo, instead formatting with the default.

From what I know so far, biome doesn’t support monorepo at the moment, it only takes the biome.json at the root. But you could override it for subrepo, https://biomejs.dev/guides/big-projects/#monorepos

This is a question that has been asked for a long time. I think, for now, it’s acceptable to disable the extension if the binary isn’t installed.

Although, in the future, I think we will plan to ship the binary again, because we want to provide more features that are more appropriate to a LSP (refactors, rename, etc.)