Idea 自动注释模板
idea自动注释模板
参考文章:https://www.cnblogs.com/youqc/p/8721399.html
设置类注释模板:
1.选择File–>Settings–>Editor–>File and Code Templates–>Includes–>File Header.
1
/***@Auther: ${USER}*@Date: ${DATE} ${HOUR}:${MINUTE}*@Description:*/
设置方法注释模板:
步骤:
1.File->Settings->Live Templates,点击右上角的加号,选择Template Group
方法模板:
1
2
3
4
5
6
*** @Description: TODO
* @Author: $USER$
* @Date: $date$ $time$
$params$
$returns$
*/
params参数:
1
groovyScript("if(\"${_1}\".length() == 2) {return '';} else {def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList();for(i = 0; i < params.size(); i++) {if(i<(params.size()-1)){result+=' * @param ' + params[i] + ' : ' + '\\n'}else{result+=' * @param ' + params[i] + ' : '}}; return result;}", methodParameters());
return:
1
groovyScript("def returnType = \"${_1}\"; def result = ' * @return : ' + returnType; return result;", methodReturnType());
本文由作者按照 CC BY 4.0 进行授权

