When I type the name of a class which will need to be imported, IntelliJ lovingly pops up with a list of suggestions. However, most of the time those suggestions are things I’d never want to import, especially by accident — like java.awt.*.
Is there a way to prevent the packages I’ll never import from appearing in the completion list?
I’ve scoured the options but I haven’t found anything.
Depending on the IDEA version: Yes.
In 7.0.5 use menu
File -> SettingschooseCode Completionand thenExclude from Import and Completionand add the package or class that you don’t want to have in your suggestions.In version 8 and version 9 use menu
File -> Settingstype “Auto import” into the search box and use theExclude from Import and Completionbox there.In version 9 you also have the option of adding Classes and Packages to the exclude-list directly from the import suggestions context-menu: