Manage your java imports. java-import-wiz
works together with java-classpath-registry
to find the namespaces to import. While not strictly required (e.g. organizing imports will still work) it's strongly recommended.
Place the cursor on the class and press ctrlalti. If the class is unambiguous it will automatically
be added to the import statements. If multiple possibilities exists, java-import-wiz
will let you choose from a list.
You can organize imports by pressing ctrlalto.
There are two settings available to control the behavior of the import organizer.
- Separate Groups: If namespace groups (e.g.
com.
andjava.
) should be separated with an extra newline. - Import Grouping: Which namespaces should be considered "the same group" in terms
of sorting, and separation. The default setting (
[ [ "java", "javax" ], [ "com", "org" ] ]
) will setjava
andjavax
in the same group.com
andorg
will similarly be in its own group. The gif explains it well.
Sorting in one group will be alphabetical.
Groups themselves will be sorted by the first entry. E.g. [ 'com', 'org' ]
will be before
[ 'java', 'javax' ]
because com
is before java
.
Works together with autocomplete-java-minus
to insert imports after autocompleting. When autocompleting classes they will automatically be
added to the import list.