Intellij Remove Unused Imports

CTRL + ALT + O —> to remove the unused imports in windows.

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

  • Open with Desktop
  • View raw
  • Copy raw contents Copy raw contents Copy raw contents Copy raw contents
  • View blame
  • 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?

    How about Android Studio ?

    I found this way very helpful for me:
    1. Go to Window → Preferences → Java → Editor → Save Actions.
    2. Check the option “Perform the selected actions on save”.
    3. Check the option “Organize imports”.

    How do I delete unused variables in IntelliJ?

    In IntelliJ, in a . java file, some unused code is greyed out indicating that the declared variable or function is never used. Unused imports are removed using Ctrl+Alt+O.

    How do I manage imports in IntelliJ?

    In Eclipse, you press CTRL + SHIFT + O “Organize Imports” to import packages automatically. For IntelliJ IDEA, if you press CTRL + ALT + O “Optimize Imports”, it just removes some unused imports, never imports any package.

    How do I stop auto import in IntelliJ?

    You can disable auto-import on completion and use quick-fixes instead: In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | General | Auto Import. On the Auto Import page that opens, use the checkboxes in the TypeScript/JavaScript area to enable or disable import generation on code completion.

    Related Posts