Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In Eclipse I was able to register a set of classes for static import auto-completion, e.g. Math., Assert., EasyMock.*

With this enabled I was able to hit ctrl-space assertEquals, pow, createMock etc. would appear as valid code completions.

I'm struggling to find this in IntelliJ but am sure it must exist. Can anyone help?

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
164 views
Welcome To Ask or Share your Answers For Others

1 Answer

Version >= 11:

Settings -> Code Style -> Java -> Imports (tab).

Version < 11

Settings -> Code Style -> Imports

In the middle of the pane is the "Packages to Use Import with '*'" table. You can add an entry here of a fully-qualified class name, and tick the static box; now all static methods in this class will be available for auto-completion.

(I'm not sure how the static import works with specifying a package, as I've never tried it, but I don't see why it wouldn't. Specifying a super-package and ticking the "with subpackages" option could be even more interesting.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...