Add All Imports Quick Fix

I recently commented out a big chunk of code temporarily and reformatted the rest, which also optimised the imports.
When I uncommented the code, I obviously had to readd the imports back, via Alt-Enter.
However, I had to do this 9 times.
All of the imports only had 1 choice, so it struck me that an improvement would be to have Alt-Enter import ALL required classes in one go (where there is only one option).

6 comments
Comment actions Permalink

I was going to ask if you had the "Add unambiguous imports on-the-fly" option checked in Settings | Code Sytle | Imports but when I went into my settings to make sure I had the name right I noticed this option is no longer available.  Build 92.81.

The Help still shows it as an option though.  Bug?

0
Comment actions Permalink

See Settings | IDE Settings | Editor | Auto Import | Add unambiguous imports on the fly

0
Comment actions Permalink

Ah, thanks!  Searching the settings for "unambiguous" still leads me to the old location.

0
Comment actions Permalink

Thanks.
Is there any reason why this isn't ticked by default?

0
Comment actions Permalink

Actually, it doesn't work when presented with the scenario above.
You still have to press Alt-Enter 9 times.

0
Comment actions Permalink

I've found that it "kicks in" in somewhat of a strange way.  For example as you've noticed Alt-Enter won't trigger it but if you just started editing some code it'll add all the unambiguous imports soon enough.

It would make more sense if there was an intention to force it to happen on Alt-Enter.

0

Please sign in to leave a comment.