Automatic import suggestion

I find myself very often typing something like:

Map<String,String> map = new

When I press CtrlShiftSpace, it says "No completions", because Map is not
imported yet, but if I wait about half a second, the auto-import kicks in,
and java.util.Map is imported, and I press CtrlShiftSpace again, and I
see lots of completions.

I suggest that auto-import be executed upon pressing CtrlShiftSpace, and
probably Alt+Enter. What does everyone think of this? I will file an issue
if no one sees any problems with it.


3 comments
Comment actions Permalink

I always type the initializer first, and then use Ctrl-Alt-V to get the variable declaration. You get the same problem doing it that way, but backwards. "Introduce Variable" won't work until the auto-importer catches up and figures out the type of the initializer. I'm almost subconsciously getting used to having one second pauses in my workflow for just this reason, and that's a Very Bad Thing. If the auto-importer could be made to trigger in those cases, I would greatly appreciate it.

--Dave Griffith

0
Comment actions Permalink

Now that you said so, I must confess that I also wait and stare on the monitor until red goes black, and only then continue and use the completion. Quite stupid.

So: Great idea. JetBrains, can we have that please?

0
Comment actions Permalink

I've filed an issue about this, http://www.jetbrains.net/jira/browse/IDEA-1546

I find myself very often typing something like:

Map<String,String> map = new

When I press CtrlShiftSpace, it says "No completions", because Map is
not imported yet, but if I wait about half a second, the auto-import
kicks in, and java.util.Map is imported, and I press CtrlShiftSpace
again, and I see lots of completions.

I suggest that auto-import be executed upon pressing CtrlShiftSpace,
and probably Alt+Enter. What does everyone think of this? I will file
an issue if no one sees any problems with it.




0

Please sign in to leave a comment.