IntelliJ IDEA 常用设置
2024年7月31日大约 1 分钟
IntelliJ IDEA 常用设置
配置目录
mac中idea配置(字体、插件、外观)目录:/Users/aurora/Library/Application Support/JetBrains
window版本: C:\Users\Administrator\AppData\Roaming\JetBrains\IntelliJIdea2021.1\options
自定义代码片段
Setting => Editor => Live Templates
方法注释
*
* Description: $desc$
*
$param$
* @return $return$
* @author h.t.l
*/
// param 参数
groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {result+='* @param ' + params[i] + ((i < params.size() - 1) ? '\\n\\t ' : '')}; return result", methodParameters())
// return
methodReturnType()
类注释
/**
* $Description$
*
* @author h.t.l
* @since $date$ $time$
*/
Log注释
// loge
log.error($content$,$params$);
content 参数:
groovyScript("def params = _2.collect {'【'+it+' = {}】'}.join(', '); return '\"' + _1 + '() called with exception => ' + (params.empty ? '' : params) + '\"'", methodName(), methodParameters())
params参数:
groovyScript("def params = _1.collect {it}.join(', '); return (params.empty ? '' : params) + ',e' ", methodParameters())
// logm
log.info($content$,$params$);
content参数:
groovyScript("def params = _2.collect {'【'+it+' = {}】'}.join(', '); return '\"' + _1 + '() called with parameters => ' + (params.empty ? '' : params) + '\"'", methodName(), methodParameters())
params参数:
groovyScript("def params = _1.collect {it}.join(', '); return (params.empty ? '' : params) ", methodParameters())
自定义文件模板
Setting => Editor => File and Code Templates
类注释
// Java Header
/**
* ${DESC}
*
* @author h.t.l
* @since ${DATE} ${TIME}
*/
mapper文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="">
</mapper>
Spring Bean XML 文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
</beans>
代码提示忽略大小写
注释不顶行
生成 Serializable 序列化 UID 的快捷键
Settings => Editor => Inspections
Serializable class without 'serialVersionUID'