I'm working with intelliJ and my problem is when I start to import some temporary unused packages into my class file intellij delete those line within a second.
how can I turn off this not so nice feature?
Choose the project/module you want to remove unused import from in Project view. Then from Code menu choose Optimize imports and confirm with Run. The imports will be cleaned in whole project/module.
Disable wildcard importsIn the Settings/Preferences dialog ( Ctrl+Alt+S ), select Editor | Code Style | Java | Imports. Make sure that the Use single class import option is enabled.
4 Answers. Show activity on this post. Disable File | Settings | Editor | General | Auto Import | Optimize imports on the fly. Normally you don't need to add imports manually, IDEA does it for you.
Use Alt + Enter for importing a single package or use Alt + Shift + Enter to auto import all the unambiguous packages in the current file.
Disable File | Settings
| Editor
| General
| Auto Import
| Optimize imports on the fly.
Normally you don't need to add imports manually, IDEA does it for you.
For Scala developers: you can have enabled Settings > Editor > General > Auto Import > Optimize imports on the fly
but add exclusions into
Settings > Editor > Code Style > Scala > Imports always marked as used:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With