biomejs / biome-zed Goto Github PK
View Code? Open in Web Editor NEWBiome extension for Zed
Home Page: https://biomejs.dev
License: MIT License
Biome extension for Zed
Home Page: https://biomejs.dev
License: MIT License
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!
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).
These are my current language settings but I've tried a bunch of variations:
"languages": {
"TypeScript": {
"language_servers": [
"!typescript-language-server",
"!eslint",
"vtsls",
"biome"
],
"preferred_line_length": 88,
"wrap_guides": [88],
"format_on_save": "on",
"formatter": {
"language_server": {
"name": "biome"
}
},
"code_actions_on_format": {
"source.fixAll.biome": true,
"source.organizeImports.biome": true
}
}
}
I've tried on Zed Preview 0.146.1
and also Zed 0.145.1
.
I can trigger the code action inside the editor so I believe the LSP is set up properly:
Also formatting seems to work. Any suggestions would be appreciated.
I'm not sure if this is an extension or Zed issue, but we'd like the errors for a given file to only show the relevant errors of the nearest biome.json file.
We have the following file structure:
๐ biome.json
โก๏ธ ๐ API biome.json (extends parent - allows import type because NestJS)
โก๏ธ ๐ client biome.json (extends parent - requires import type)
Currently, it seems like the errors shown for a given file only show based upon the setting of the parent biome.js. I'd prefer not to open up the API and client folders in different instances of Zed if at all possible. Thanks!
Issue Link (Zed Issues): zed-industries/zed#13492 (comment)
The upcoming version of Biome (1.8) will introduce support for CSS.
We should prepare a PR to add support for the CSS language to the extension
We should provide a way of loading a custom biome binary for development purpose.
Issue: Biome Extension Overwrites Custom Formatting with Default Biome Formatting
Description:
When running npx @biomejs/biome format --write src
to format biome files, the operation completes successfully and applies the custom formatting as expected. However, when utilizing the biome extension, it overrides the custom formatting with the default biome formatting.
Steps to Reproduce:
Run npx @biomejs/biome format --write src to format biome files with custom formatting.
Confirm that the custom formatting is applied correctly.
Enable the biome extension in the project.
Trigger biome formatting via the extension.
Expected Behavior:
The biome extension should respect and maintain the custom formatting applied to biome files when formatting them. It should not overwrite custom formatting with default biome formatting.
Actual Behavior:
Despite successful custom formatting using the CLI command, the biome extension disregards the custom formatting and applies default biome formatting when triggered.
Impact:
This issue disrupts the workflow of users who rely on custom formatting for biome files. It leads to inconsistencies and frustration as the extension overrides user preferences without regard for existing formatting choices.
Proposed Solution:
Update the biome extension to preserve custom formatting when formatting biome files. Ensure that the extension respects the formatting applied via CLI commands and does not overwrite it with default biome formatting.
Additional Information:
Extension Version: 0.0.6
Operating System: Mac OS 14.4.1
This issue significantly affects the usability and effectiveness of the biome extension for users who rely on consistent formatting practices. Prompt resolution or guidance on how to preserve custom formatting would be greatly appreciated.
Is there any configuration needed to make sure Zed is prefering Biome over native ESLint?
When I install the extension (v0.0.2
) in Zed Preview (v0.131.4
), it creates a different formatting output in JS files vs. the Biome CLI. It seems like it is doing something when saving (adjusting spaces or so), but that seems to be more the output from ESLint or some other language server.
Actually running bunx biome format index.js --write
however reformats the whole file (replaces spaces with tabs, which also seems to be the default) - which would be the intended way.
Is there any other way to debug or improve this?
This is in settings.json
:
"format_on_save": "on",
"code_actions_on_format": {
"source.fixAll": true,
"source.organizeImports.biome": true
},
"formatter": "language_server"
Adding a biome.json
with some arbitrary values like formatter.indentWidth: 16
also shows that it doesn't get picked up, while the CLI replaces that.
biome.json
{
"$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto"
},
"javascript": {
"formatter": {
"enabled": true,
"quoteStyle": "single"
}
},
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": { "recommended": true }
}
}
package.json script for formatting: "format": "biome format --write \"src/**/*.ts\" \"test/**/*.ts\"",
zed settings.json
{
"format_on_save": "on",
"code_actions_on_format": {
"source.fixAll": true,
"source.organizeImports.biome": true
},
"formatter": "language_server"
}
When I'm trying to save any file, biome doesn't format it. But I see that biome is work, because in vscode it works fine.
In version 0.1.0, the extension doesn't able to locate the biome language server, which likely due to this change be0e886.
My current workaround is to customize the lsp binary in settings
"lsp": {
"biome": {
"binary": {
"path": "node_modules/@biomejs/biome/bin/biome",
"arguments": ["lsp-proxy"]
}
}
}
Seems the HTML get's purged.
https://github.com/biomejs/biome-zed/assets/8741666/54bd4c63-97ab-46ab-9ee5-349e733a3e04
There still are differences in formatting in zed vs cli after updating to 0.146.3
. I am not sure if this is zed issue or biome issue.
Here's a simple reproduction for this: https://github.com/Marcisbee/zed-biome-reproduction-1
Have I configured something wrong or is there a bug somewhere?
Also can try adding this to index.ts file:
const something
= 123;
Cli says it's an error, but running formatter from zed, does nothing with this.
Biome: 1.8.3
Zed: 0.146.3 (also happens in Zed Preview 0.147.0)
settings.json
{
...
"lsp": {
"biome": {
"settings": {
"require_config_file": true,
"config_path": "<path>/biome.json"
}
}
},
"formatter": {
"language_server": {
"name": "biome"
}
},
"code_actions_on_format": {
"source.organizeImports.biome": true,
"source.fixAll.biome": true
}
}
I did not figure it out what is triggering this bug, but the code actions is simply not showing up after a random period of time after the IDE is open. Most of the times this bug happens within a minute or two after the IDE is open. The only way to make code actions work again is by restarting the IDE or disabling the Biome extension.
By freezing I mean that when I press cmd + . to trigger the code actions menu, nothing happens.
I have a mid-sized TypeScript project where I've recently switched from ESLint/Prettier to Biome. After installing this extension, I have the following issues:
Any ideas how to fix this? :-)
i'd like to configure the command line --config-path
arg via my settings json as I commonly work in a monorepo that has a single node package within a larger project <root>/js
(or similar). So i'd like to configure my <root>/.zed/settings.json
to always point to <root>/js/biome.json
instead of having to open zed with js
as the root.
The JSON format stop working after enabling the organize import options:
"code_actions_on_format": {
"source.organizeImports.biome": true
}
Zed: v0.142.3 (Zed Preview)
OS: macOS 14.5.0
Memory: 16 GiB
Architecture: aarch64
Biome: 1.8.3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.