IDEA中设置注释模板

IDEA中设置注释模板

类设置路径

File->Setting->Editor->File and Code Temolates

image-20220221120357010

注释模板:

/**
* @Notes  
* @date ${DATE}
* @time ${TIME}
* @author smile
* @example
* @link
*/

方法注释路径

File->Setting->Editor->Live Templates
创建模板库组

image-20220221122839630

创建成功

image-20220221122956516

在模板库组中创建模板文件

image-20220221123231380

注释模板:

**
 * @Notes 
$params$
 * @return $return$
 * @author smile
 * @date $date$
 * @time $time$
 **/
设置生效

image-20220221142311643

设置变量

image-20220221144047280

参数模板

groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) { if(params[i] == ''){ result+= ' * '; }else{ result+=' * @param ' + params[i] + ((i < params.size() - 1) ? '\\r\\n' : '')}}; return result", methodParameters()) 

使用方法

/*+模板名+Enter-->/**+Enter

按照截图得知:我们自定义的模板名为*,那么使用方法 /** + Enter

posted @ 2022-02-21 14:49  易文杰  阅读(418)  评论(0)    收藏  举报