feat: biome organize imports#599
feat: biome organize imports#599stevearc merged 3 commits intostevearc:masterfrom igorlfs:feat/biome-sort-imports
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) cc @andrew-t-james-core @rahulpeacock |
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.