How to delete all unused imports from current project in Intellij Idea

Prashant :

I have been using Intellij Idea for quite some time now. I have a few questions though. Is there a way to delete all unused imports from all files in the current project?

I know that I can choose menu item Code > Optimize Imports (CTRL + ALT + O) to organize imports in individual files but since the application that I am working on has hundreds of files, this process does not make any sense. If there is no way of doing this, can I create a macro for this? If so, how do I do it?

xingbin :

Click the project folder, then enter CTRL + ALT + O. It will handle all files under the folder:

enter image description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=35927&siteId=1