IDEA插件配置之Eclipse Code Formatter

Eclipse、Intellij idea格式化结果不同,致使长时间都是用两个开发工具,idea开发eclipse进行格式化。可是如今这个问题能够解决了。使用Eclipse Code Formatter。网络


具体的插件地址:eclipse

http://plugins.jetbrains.com/plugin/6546?pr=idea&offset=15&max=15#comments_panide


Intellij idea:工具

1,安装插件:开发工具

    硬盘安装(推荐):Setting =>Plugins=>Install plugin from disk,选中下载好的安装包【EclipseFormatter.zip】安装,重启后生效;idea

    网络安装:选择Setting =>Plugins=>Browse repositories,搜索Eclipse便可出现,点击左上角的Download and Install安装。安装以后重启Intellij,插件

安装完成便可在Setting =>Eclipse Code Formatter找到配置项。code


2,配置插件:orm

选择Setting =>Other Settings =>Eclipse Code Formatter,勾选Use the Eclipse-code-formatter,并在Eclipse Java Formatter config file选择Eclipse用的code-style.xml文件,这个选项会决定格式化代码的方式。再选择Java formatter profile 为刚刚导入的文件。同时配置Import order的From File也为Eclipse用的code-style.xml文件,这个选项会决定组织import区域的方式。xml


3,使用插件

使用Intellij的格式化快捷键”Ctrl+ALT+L”便可进行格式化。若是出错会输出提示到Event Log里,若是看到’xxx formatted sucessfully by Eclipse code formatter’则表示格式化成功!

相关文章
相关标签/搜索