Formatting
Organize imports on save
Formatting · 1 min read
When you save, the list of other files your file uses gets sorted, and any it no longer uses are removed.
When you would want it
Import lists grow messy on their own and nobody ever tidies them on purpose.
Where to find it
- All Features → Organize imports on save
- Organize now
- Turn on or off
- Settings
What you get out of it
- Import lists stop accumulating the debris of past refactors.
- Sorted imports make scanning dependencies instant and diff-clean.
How to use it, step by step
- Turn it on in Formatting settings; it is deliberately off by default.
- From then on, every Ctrl+S also sorts the import block and drops imports nothing uses.
- Want it once rather than always? Edit - Organize Imports does it on demand, and tells you when everything was already tidy.
- Off by default because it can delete a line you did not ask it to - that choice should be yours.
Why this beats the usual way
Import tidying is either automatic-and-silent (deleting things by surprise) or manual-and-never-done. Offering both - on command by default, on save by choice - is the honest middle.
Find it in Universal Search
Organize imports on save · Formatting · sort imports · unused import · tidy imports