biomejs / biome-zed

Biome extension for Zed
https://biomejs.dev
MIT License
168 stars 6 forks source link

Enable biome only when biome.json is present gives error #59

Open kjvdven opened 1 month ago

kjvdven commented 1 month ago

I followed the docs to only Enable biome only when biome.json is present. And I added the following code to my config.

"lsp": {
    "biome": {
      "settings": {
        "require_config_file": true
      }
    },
}

Now I expected Biome to be disabled on projects without a config file.

But instead I get the following error;

Language server error: biome

biome.json is not found but require_config_file is true
-- stderr--
luckydye commented 1 month ago

It's a limitation of zed extensions at this time. There is currently no other way of canceling the server start, except by throwing an error.

If there if a better approach, PRs are welcome.

Otherwise, if you want to actually only enable the language_server in specific projects, follow this guide: https://biomejs.dev/reference/zed/#project-based-configuration

silvenon commented 1 month ago

The require_config_file option lead me to believe that it's a solution to running the extension only in projects that use Biome, so maybe it would be better to withdraw this feature until it's actually possible to automatically not run the extension in projects where it's not installed.

jbergstroem commented 3 weeks ago

It's a limitation of zed extensions at this time. There is currently no other way of canceling the server start, except by throwing an error.

Is there a tracking issue for this?

luckydye commented 3 weeks ago

It's a limitation of zed extensions at this time. There is currently no other way of canceling the server start, except by throwing an error.

Is there a tracking issue for this?

I don't think so.

kjvdven commented 3 weeks ago

I did make an issue on the Zed repository. https://github.com/zed-industries/zed/issues/19589

ematipico commented 3 weeks ago

Have you tried requireConfigFile?

silvenon commented 3 weeks ago

Have you tried requireConfigFile?

Instead of require_config_file? It doesn't prevent Biome from running in a non-Biome project, but unlike require_config_file something different happens — the extension manages to run Biome even though Biome is not installed that workspace. With require_config_file the extension itself fails in a non-Biome project 🤔