intellij是否可以像在Eclipse中一样组织导入? [英] Is it possible for intellij to organize imports the same way as in Eclipse?
问题描述
我正在开发一个项目,所有团队成员都使用Eclipse,而我是唯一的IDEA用户。这会从导入重新排列中产生大量噪音。 eclipse导入的顺序是:Java,Javax,Org,Com,其他所有内容都按字母顺序排列。是否可以配置IDEA遵循这些规则?
I'm working on a project where all the team members are using Eclipse and I'm the only IDEA user. This creates a lot of noise from imports rearrangements. The order in which eclipse imports is: Java, Javax, Org, Com, everything else in alphabetical order. Is it possible to configure IDEA to follow these rules?
推荐答案
更多细节:我最终执行这些步骤以匹配框eclipse组织:
Some more details: I ended up performing these steps to match out of the box eclipse organizing:
(在设置
> 编辑
> 代码样式
> Java
> 进口
,如上所述通过@yole)
(in Settings
> Editor
> Code Style
> Java
> imports
, as mentioned by @yole)
-
设置类计数使用导入'*'到99(好像你不能把这个转过来off)
set "class count to use import with '*'" to 99 (seems like you cannot turn this off)
设置此排序(如eclipse默认值):
set this ordering (like eclipse defaults):
static all other,
blank,
java.*,
blank,
javax.*,
blank,
org.*,
blank,
com.*,
blank,
all other imports
FWIW,有一个名为 eclipse code formatter 我为此评估了最终丢弃,因为它设置了一个单独的快捷方式(在OSX中),已被核心IDE功能使用。
FWIW, there is an Intellij plugin called "eclipse code formatter" that I evaluated for this purpose and ended up discarding, because it set up a separate shortcut (in OSX) that was already in use by core IDE functionality.
这篇关于intellij是否可以像在Eclipse中一样组织导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!