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?
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 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.