- 下载代码格式文件(p3c)
地址:
https://github.com/alibaba/p3c
位于p3c-formatter
2. idea安装插件(Eclipse Code Formatter)
需要配置:
选择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区域的方式。
使用
使用Intellij的格式化快捷键”Ctrl+ALT+L”即可进行格式化。如果出错会输出提示到Event Log里,如果看到’xxx formatted sucessfully by Eclipse code formatter’则表示格式化成功!
4126

被折叠的 条评论
为什么被折叠?



