biomejs / biome-zed

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

Extension runs in every project? #15

Closed silvenon closed 2 months ago

silvenon commented 3 months ago

Thanks su much for building an extension for Biome ❤️ That's really awesome of you, both Biome and Zed are so new, I didn't expect an extension would even exist!

One thing I noticed is that I'm getting Biome annotations in projects that don't use Biome, I didn't even know Biome can run without a config file.

I don't know Rust, but ChatGPT tells me that the extension script installs Biome if one isn't found in the depenedencies? Can we configure the extension to only run if the configuration file is found, or/and only if the extension exists in the dependencies?

Thanks!

ematipico commented 3 months ago

One thing I noticed is that I'm getting Biome annotations in projects that don't use Biome, I didn't even know Biome can run without a config file.

Really?? It's literally in our homepage: https://biomejs.dev/ The first snippet you see, runs from npx without any configuration 😅

Can we configure the extension to only run if the configuration file is found, or/and only if the extension exists in the dependencies?

Not sure if it's possible at the moment with the current status of zed extensions. I don't know if zed exposes an API to read settings.json to the extensions .

silvenon commented 3 months ago

I was migrating from away ESLint while burnt out, so I jumped straight into docs, that detail slipped past me 😄 But nice!

Until Zed provides some configuration leeway, isn't it safe to assume that if you don't have Biome installed in your project then you probably aren't using it? I feel like that's an ok compromise to make.

Otherwise I have to uninstall the extension when editing another project, and install it back when editing my Biome project, right?

chungweileong94 commented 3 months ago

Not sure if it's possible at the moment with the current status of zed extensions. I don't know if zed exposes an API to read settings.json to the extensions .

I did look into that before, zed seems to expose some LSP settings API for the extension author, but I wasn't able to get any further than that. However, my current workaround is to disable the biome LSP globally by default:

"language_servers": ["!biome", "..."]

Then enable in project setting .zed/settings.json:

"language_servers": ["..."]
silvenon commented 3 months ago

That's a cool trick, and appears to be exactly what I wanted, thanks! 🥳

luckydye commented 2 months ago

I suppose we can close this then :) Further configuration for this is more a zed issue.