Can't figure out how to have import take place automatically without alt-enter?

What I would like is if there was only one match for an import when I start typing a class name to have IDEA automatically add the import without prompting me with "alt-enter." I can see in the options how to turn off getting prompted when I paste in code that requires imports but not how to avoid being prompted when I manually type.

What is also frustrating is say I start typing really fast
ArrayList list = list. but I had not used alt-enter to impor the ArrayList until after typing the '.', I then don't get autocompletion after accepting the import. I have to backspace over the '.' and type it again. It would be nice if I could just get the imports to happen automatically. I've looked at the help file under Import Assistant and didn't find a solution there. Thanks for any help.

3 comments

There's no way to import without the popup. The Tracker issue for this is at http://intellij.net/tracker/idea/viewSCR?publicId=13371 . There you can see a long discussion about why people think this should and should not be implemented. You can vote for it if you sign up for a Tracker account.

You could press Ctrl+Space after accepting the import to show possible autocompletions. If you think what you're seeing is a bug, you should file a Tracker issue.

0

Wow, I filed that issue over a year ago and it was still in state "to be discussed".
Today after reading you post, I added a comment to the issue asking wether it can be included in Irida (Idea 5.0) and guess what:
It has already been implemented! Thanks Alexey!
Really looking forward to the first Irida EAP version.

0

Rick wrote:

What I would like is if there was only one match for an import when I start typing a class name to have IDEA automatically add the import without prompting me with "alt-enter." I can see in the options how to turn off getting prompted when I paste in code that requires imports but not how to avoid being prompted when I manually type.

What is also frustrating is say I start typing really fast
ArrayList list = list. but I had not used alt-enter to impor the ArrayList until after typing the '.', I then don't get autocompletion after accepting the import. I have to backspace over the '.' and type it again. It would be nice if I could just get the imports to happen automatically. I've looked at the help file under Import Assistant and didn't find a solution there. Thanks for any help.


1. Try using Ctrl-Alt-Space after typing "ArrayList".
2. After using Alt-Enter to import after typing the ".", try pressing
Ctrl-Space to do autocompletion.

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0

Please sign in to leave a comment.