Static import suggestions

Hi

First I need to mention that I'm not using a "clean" IntelliJ but Android Studio (1.2 currently, based on IntelliJ 14.1.1). With that said when I was an Eclipse user I valued very much static imports suggestions. Basicaly all I had to do was to name some static imports (by the full path) in the Eclipse settings and then when I started to type any of the static method from those entries I've put in settings I had a suggestion to use a static import. All was automatic.

I've seeked for similar functionality with IntelliJ and I'm sadden by the fact I cannot find such a usefull feature. I did find the "Packages to Use Import with" section in Code Style -> Java -> Imports settings but I can't make it to work (or maybe it's not what I'm looking for).

Does IntelliJ has this feature?

4 comments
Comment actions Permalink

I don't think that's possible in IDEA right now.

In this ticket I proposed to move the list of "static importable classes" from the "Static import" inspection to the code style import setting:
https://youtrack.jetbrains.com/issue/IDEA-111748

Maybe file an issue that the "Auto Import" list should get an option to auto import statics from "static importable classes".

0
Comment actions Permalink

It seems that this request already exists:
IDEA-103995
Vote / comment on it. Maybe if there's enough activity, it will be implemented sometimes soon.

0
Comment actions Permalink

Thanks Stephen for pointing that out. This is one of those cases where Eclipse comes on top. It's handling of static imports like that is way, way ahead.

0
Comment actions Permalink

Hi. I've checked the static import on the newest Android Studio (2.1) based on the IntelliJ 15 and the automatic import on the fly doesn't seem to work. I wrote a public static method in one class and tried to use it in other class, but the static import was not added on the fly. When I hit Alt+Enter I do see the static import, but it doesn't seem to work on the fly.

0

Please sign in to leave a comment.