IDEA 代码风格设置

1.类注释

File -> Settings -> Editor -> File and Code Templates -> Includes -> FileHeaderjava

/**     
  * @describe: TODO 
  * @author: zhuCw
  * @date: ${DATE} ${TIME}
  */

2.缩进

采用4个空格缩进,或者设置tab键为4个空格, 不能勾选Use tab character,参考下图shell

File -> Setting -> Editor -> Code Style -> java -> Tabs and Indentside

3.插件

3.1 google-java-format (格式化代码)

File -> Setting -> Marketplace -> 搜索google-java-format -> install -> Disableui

3.2 save actions (保存格式化)
  • 安装 :File -> Setting -> Marketplace -> 搜索 save actions -> install -> Disablegoogle

  • 设置 File -> Setting -> Other Setting -> Save Actions插件

    • 保存自动格式化
    • 去掉多余imports
    • 保存时格式化整个文件
    • 修改CodeStyle为Android Open Source Project(AOSP) stype 由于 goole style 缩进为两个空格与阿里推荐4个空格冲突


3.3 Alibaba Java Coding Guidelines plugin (阿里代码规范扫描)
  • 安装:File -> Setting -> Marketplace -> 搜索 Alibaba Java Coding Guidelines plugin -> install -> Disable代码规范

  • 扫描方法code

    选中扫描的项目 -> 右键orm

  • 扫描结果blog

4.导入Setting

  • setting文件 在百度云盘
连接:https://pan.baidu.com/s/1azh6PAVWgiGWzpotaJV7eA 
提取码:dg48

File -> Settings -> Code Style -> 设置图标 -> import Scheme

相关文章
相关标签/搜索