When I press Ctrl + Alt + L, IDEA removes unused import. I want to turn this feature off, leave the unused imports there. Where can I affect this setting?
IntelliJ IDEA code reformat options
Asked Answered
First check:
File | Settings | Editor | Formatting | Show "Reformat Code" dialog
Then when you hit Ctrl + Alt + L pop-up dialog will appear.
Uncheck Optimize imports and check Do not show this dialog in the future. Hit Enter or click Run. That's it!
In Intellij 14 this has moved to File > Settings > Editor > General, and then under a "Formatting" section within General. –
Chaetopod
In intellij 14.1.1, there is not setting. It is moved to a new key binding shift + Cmd + Alt + L which always shows the dialog –
Tosh
@RajaniKaruturi this saved my day. I have been looking all over for this setting since I upgraded to 14.1+. Thanks –
Bettencourt
In IDEA 2018, you can hit Ctrl
+ Alt
+ Shift
+ L
and the reformat file pop-up will appear. Then you can check/uncheck the "Optimize Imports" option.
© 2022 - 2024 — McMap. All rights reserved.