idea常用配置

Inspection 代码检查

在设置目录中,editor –> inspections用来配置各种代码检查以及警告。

  1. 开启import *提示
    editor –> inspections –> java –> imports
    勾选* import
  2. 工具类必须为final、不能含有public构造方法、必须有private构造方法
    editor –> inspections –> java –> class structure
    勾选utility class is not final
    勾选utility class with public constructor
    勾选utility class without private constructor
  3. equals()与hashCode()方法必须成对出现
    editor –> inspections –> java –> probable bugs
    勾选equals and hashcode() not paired
  4. 可序列化类没有声明serialVersionUID
    editor –> inspections –> java –> Serialization issue
    勾选Serializable class without 'serialVersionUID'

Code Style 代码风格

  1. else新起一行
    editor –> code style –> java –> if() statement
    勾选else on new line
    force brace选择always
  2. 方法参数过长自动换行
    editor –> code style –> java –> method declaration
    parameters选择wrap if long
  3. 禁用import *
    editor –> code style –> java –> imports
    class count to use import with * 填写 500
    names count to use static import with *填写 500
  4. 配置import顺序
    editor –> code style –> java –> imports –> import layout
    参考链接(stackoverflow.com)

IDE配置

  1. 自动import
    editor –> general –> auto import
    勾选optimize imports on the fly
    勾选add unambiguous imports on the fly
  2. 编辑器显示行号
    editor –> general –> apperance
    勾选show line numbers
  3. 自动补全main函数
    editor –> live templates –> other
    右侧点击加号,如下图配置
    image
  4. 去掉新文件自动添加的created by注释
    editor –> file and code templates
    找到需要修改的模板,按图中所示,将红框内内容替换为空行
    image
  5. 版本控制显示修改文件及目录
    version control
    勾选show directories with changed descendants
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值