IDEA插件配置之Eclipse Code Formatter

Eclipse、Intellij idea格式化结果不一样,导致长时间都是用两个开发工具,idea开发eclipse进行格式化。但是现在这个问题可以解决了。使用Eclipse Code Formatter。

1,安装插件:

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

2,配置插件:

选择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区域的方式。

3,使用插件

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

猜你喜欢

转载自1028826685.iteye.com/blog/2364085