[v2] Run organizeImports as part of formatting + WebStorm Support #7534
Danielku15
started this conversation in
Ideas
Replies: 2 comments
-
biome check --write This command will format your code, applies all safe fixes, and organises the imports.
We have the "Enable LSP-based code formatting" option to do that. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I also think lsp formatting should trigger organize import (#7568) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Would it be possible to add again an option (to Biome itself) to organize imports when the formatter is running? Relying on a separate IDE action has drawbacks I want to mitigate. Also I have the feeling that the WebStorm integration needs some improvements. In detail:
Need 1: Only trigger 1 action when manually formatting code.
Due to my workstyle I also do not want to auto-organize imports or auto-format on save. I explicitly trigger formatting regularly when I completed some section of code.
When I work with VS Code I am currently forced to first format the code (CTRL+SHIFT+F), and then trigger also the import organization (CTRL+SHIFT+O) to the the file clean again.
Need 2: Run
organizeImports
as part of scriptsLet it be a CI bot "correcting" a Pull Request, or a pre-commit hook formatting the files before committing. While normal formatting can easily be done, I could not find a way to also run an
organizeImports
as part of such steps. The docs only mention IDE integrations.Need 3: Remove unused imports (Webstorm only?)
Not sure if VS Code has some other built-in feature for this. But when I run the "Optimize Imports (Biome)" quick fix on a it only sorts the imports but does not remove unused imports. The normal actions menu only lists a "Sort Imports with Biome" action. To have a full clean-up it would be great if Biome can do everything in WebStorm.
At least the naming should be made consistent?
Need 4: Use Biome as Default Formatter in WebStorm.
WebStorm has a feature for Prettier to run it on a "Format Code". The Biome Plugin options only offer a "run on save". I'd love to just run the default formatter shortcut and Biome kicks in where possible & configured.
Need 5: 'Format with Biome' action.
In extension to "Need 4": It seems not possible to manually format a document explicitly with Biome. Would be good to have a action which triggers the format with Biome.
I'm open to any feedback how to achieve my needs without changes in Biome 😁
Beta Was this translation helpful? Give feedback.
All reactions