Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Optimize Imports for the entire scala project

One of the very useful features of IntelliJ is that when I am done editing a file, I can do a "optimize imports". this removes all the unused imports from my code.

This is very useful, but I have to do it for every file.

Can I do "optimize imports" for the entire project?

like image 394
Knows Not Much Avatar asked Jun 05 '17 05:06

Knows Not Much


People also ask

How do I clean up imports in IntelliJ?

CTRL + ALT + O ---> to remove the unused imports in windows. However, you can also change the keymap of "Optimize Imports" in settings.

How do I stop IntelliJ from optimizing imports?

5 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.

How do I change import settings in IntelliJ?

Import settings from a ZIP archive Call File | Manage IDE Settings | Import Settings from the main menu. Select the ZIP archive that contains your settings in the dialog that opens. Select the settings you want to apply in the Select Components to Import dialog that opens and click OK.


1 Answers

Select the source root in the project tree;

1. Hit the keyboard shortcut for "Optimize import"

MAC

Cmd-shift-A  

Windows

Ctrl-shift-A  

2. You will see

dialog of auto import

3. Hit Run

like image 73
JB Nizet Avatar answered Sep 30 '22 16:09

JB Nizet