IntelliJ Static Import Completion

前端 未结 7 1996
别跟我提以往
别跟我提以往 2020-12-08 12:39

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 ct

7条回答
  •  佛祖请我去吃肉
    2020-12-08 13:22

    If you're using IntelliJ 10, try the following:

    assEq
    

    Accepting a suggestion from the resulting popup list will, by default, insert a ClassName.methodName() reference (which you can convert to a static import using an Alt-Enter intention).

    You can also insert a statically imported method from the completion list by choosing "Right" in the completion menu, and selecting "Import Statically":

    enter image description here

    Note that once you've statically imported a single method from a class (Assert.assertSame), other static methods from that class (like Assert.assertEquals) will be included in the "regular" code completion (Ctrl-Space).

提交回复
热议问题