IntelliJ IDEA lets you manage your imports in Scala the same way as it does in other languages.

You can configure imports in the Project Settings and in the IDE Settings. You can also optimize your imports and exclude classes from auto-import in the editor.

1.Project Settings

You can format your imports using Project Settings.

In the Settings dialog, select

{span:class=shortcut}Project Settings{span}
{span:class=shortcut}Code{span}
{span:class=shortcut}Scala{span}
{span:class=shortcut}Imports{span}
.

2.IDE Settings

You can configure the behavior of the imports in your workspace through the IDE Settings.

In the Settings dialog, select

{span:class=shortcut}IDE Settings{span}
{span:class=shortcut}Editor{span}
{span:class=shortcut}Auto Import{span}
.

 You can select the following options:

If you skip an import suggested in the Ask mode or choose the None mode, the non-imported classes will be red-highlighted and an import pop-up window will appear to help you create import statements using the Alt+Enter keyboard shortcut.

3.Optimizing Imports

You can optimize imports selecting

{span:class=shortcut}Code{span}
 →
{span:class=shortcut}Optimize Imports{span}
command.

In this dialog box, specify from where you want IntelliJ IDEA to remove unused import statements, in order to optimize the import procedure.

4.Excluding Classes from Auto-Import

If the list of suggested imports is too wide, you can exclude unnecessary classes on the fly using intention actions.

Start typing a name in the editor.

In the Class to Import suggestion list, click

{span:class=shortcut}Alt{span}
+
{span:class=shortcut}Enter{span}
, and click the right arrow to reveal the nested list of intention actions. IntelliJ IDEA suggests you to exclude specific class or the whole containing package.

In the dialog that opens perform necessary changes and click OK.