filmov
tv
IntelliJ IDEA Tips & Tricks #16: Remove unused import statements on the fly
Показать описание
Unused import statements can happen due to many reasons. For example, you had written some code and deleted only the code, leaving the import statements unused.
(1) Fortunately, you can automatically remove the unused import statements. From the context actions (Alt + Enter), choose "Optimize Imports" and IntelliJ IDEA will remove all the unused imports from the code!
(2) You can also remove the unnecessary import statements anywhere from the editor - by selecting the combination - Ctrl + Option + O (Ctrl + Alt + O in Windows/Linux).
(3) Finally, you can enable the "Optimize imports on the fly" option in Preferences (Editor - General - Auto Import and click the checkbox there).
(1) Fortunately, you can automatically remove the unused import statements. From the context actions (Alt + Enter), choose "Optimize Imports" and IntelliJ IDEA will remove all the unused imports from the code!
(2) You can also remove the unnecessary import statements anywhere from the editor - by selecting the combination - Ctrl + Option + O (Ctrl + Alt + O in Windows/Linux).
(3) Finally, you can enable the "Optimize imports on the fly" option in Preferences (Editor - General - Auto Import and click the checkbox there).