Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Import Suggestions in IntelliJ

Is there a way to get a list of import suggestions in IntelliJ IDE? I'm looking for the equivalent of CTRL+SHIFT+O functionality from Eclipse, which automaticaly lists import suggestions.

Thanks!

like image 892
Anton Belev Avatar asked Jul 01 '14 15:07

Anton Belev


People also ask

Why is IntelliJ autocomplete not working?

I have tried the following according to this thread (Intellij IDEA CE 12 Android XML Code Completion not working): Go to File->Power Save Mode and disable it - it is off. Go to Preferences->Editor->Code Completion and check Autopopup code completion - this has been checked. Go to File->Invalidate Caches and restart.

How do I sort 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 enable auto import dependencies in IntelliJ?

Select how IntelliJ IDEA should process references to missing classes and methods in pasted blocks of code: All: import statements will be added automatically for all missing classes and methods found in pasted blocks of code. Ask: IntelliJ IDEA will prompt you to select which classes and methods you want to import.


1 Answers

On my current machine (on Windows), it's Ctrl-Alt-O, and the command is named "Optimize imports".

In general, in IntelliJ IDEA, you can use Ctrl-Shift-A and press part of a command to find it and know the appropriate shortcut. Typing Ctrl-Shift-A (or if you're on a Mac -Shift-A) and then search for "import" allows finding this command easily.

That said, it seems this command doesn't suggest imports like Eclipse does.

like image 154
JB Nizet Avatar answered Oct 10 '22 07:10

JB Nizet