目录
生成类注释
类注释模板:
/**
* @program: ${PROJECT_NAME}
* @description: ${description}
* @author: 作者名称
* @date: ${YEAR}-${MONTH}-${DAY} ${HOUR}:${MINUTE}
**/
步骤:
- 打开Preferences(快捷键
command + ,
) - Editor -> File and Code Templates -> Includes -> File Header
- 效果图
生成方法注释
方法注释模板:
模板中第一行我没有给定斜杠 /
,因为会出现一个小bug。因为我们使用时先在方法上输入/
+你的 Abbreviation
**
* @description: $description$
$params$
* @return: $returns$
* @author: King
* @date: $date$
*/
- 打开Preferences
- Editor -> Live Templates -> 点击右边加号为自己添加一个Templates Group -> 然后选中自己的Group再次点击加号添加Live Templates
设置Expression:
params:
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 ’ : ‘’)}; return result", methodParameters())
return:
选择 methodReturnType()
date:
date(“yyyy-MM-dd HH:mm”)
- 使用,给方法添加注释
/
+method(我自己设置的Abbreviation)
+tab或者回车
效果: