However, you can also change the keymap of “Optimize Imports” in settings.
In IntelliJ IDEA, Ctrl + Alt + O is the shortcut keys to remove/optimize unused imports for Windows/Linux operating system, and control + option + O is for Mac OS.
Users who have contributed to this file
Detect & cleanup unused imports across your entire project
Elm code tends to accumulate imports over time, some of which may no longer be needed. Keep your code clean by getting rid of imports that are no longer necessary.
The performance impact of this feature by itself is negligible but it depends on core IDE functionality which does increase CPU and RAM usage in the background.
The plugin automatically detects unused imports and shows them in gray. To remove an unused import, put the cursor on it, then press Option-Enter (macOS; Alt-Enter on Windows/Linux), and then select Optimize imports.
You can also search for unused imports across your entire Elm project. Open IntelliJs “Search Anything” popup by pressing Shift-Shift. Then type Run inspection by name. Then type Unused import and pick the “Elm” one.
How do I get rid of unused import?
I found this way very helpful for me:
- Go to Window → Preferences → Java → Editor → Save Actions.
- Check the option “Perform the selected actions on save”.
- Check the option “Organize imports”.
How do I delete unused variables in IntelliJ?
How do I manage imports in IntelliJ?
How do I stop auto import in IntelliJ?