IntelliJ Organize Imports

后端 未结 14 1030
孤街浪徒
孤街浪徒 2020-12-02 04:48

Does IntelliJ have an Organize Imports feature similar to that in Eclipse? What I have is a Java file with multiple classes missing their imports. Example:

p         


        
14条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 05:25

    I finally created a workaround around this frustrating issue. I'm not completely happy with the workaround, but it's better than nothing.

    Basically, after you paste the source code and unambigous imports are fixed, just press F2 to highlight the next compiler error. If the current error is an import-missing error, press Alt+Enter, then Enter to select the Import option, then pick the correct import. Then, press F2 again.

提交回复
热议问题