-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: biome organize imports #599
Conversation
Uh, I just realized I can achieve the same result by disabling formatting, inside Biome's configuration. Specifically, here's the snippet for my use case (Svelte): "formatter": {
"enabled": true,
"ignore": [
"**/*.svelte",
]
} Coupled with the I was considering closing this PR, but I noticed it was mentioned elsewhere, and it would close #585 (I guess) |
Biome currently doesn't support proper formatting for HTML-like languages, such as Svelte. However, it can already be used to sort imports. So, an additional formatter is still necessary to actually format the rest of the file. To handle this situation gracefully, we need to disable formatting for svelte files within the Biome configuration. This restricts the biome-check formatter to only sort imports. See stevearc/conform.nvim#599 To run the actual formatter, the LSP needs to format either before or after biome-check. Arbitrarily, I chose the LSP to run before, by using `lsp_format = "first"`. The last step is to enable handle LSP formatting within the `format_on_save` function, which needs to match the behavior of formatting before biome-check.
How would you expect this formatter to be used, and is the use case different from the |
|
Sounds reasonable to me. Thanks for the PR! |
Hello!
This PR adds another biome formatter, to only organize imports (in a similar manner to ruff, with ruff's organize-imports).
The major reason for another formatter is that there are some known limitations when using biome's regular formatter with HTML super languages, such as Svelte and Vue.