简介:统一代码格式包含编码、格式化
基于阿里代码规范,官方地址:https://github.com/alibaba/p3c/tree/master/p3c-formatter
1. 格式化模板导入
· 依次点击:Window->Preferences->Java->Code Style->Formatter->Import
· 选择jiupi-codetemplates.xml文件确定
· 默认在Active profile中选择新导入的P3C-CodeStyle,如未选择,请手动选 择
· 点击Apply完成配置
2. 注释模板导入
· 操作流程同上,Window->Preferences->Java->Code Style->Code Templates->Import
· 勾选Automatically add comments for new methods and types
· 点击Apply完成配置
3. 文件编码
· Window->Preferences->General->Content Types->Text->Java Properties File
· 将Java Properties File及下属的所有项均设定为 Default encoding: UTF-8
閱讀更多 小哥哥愛學習 的文章