Table of contents
1. Find the following settings
3. The apply save is completed
4. Select the file to generate the template
5. Binding selection parameters
First open the idea settings
1. Idea class comments
1. Find the following settings
2. Set the template
Class Annotation Templates and Interface Annotation Templates
/**
* @ClassName ${NAME}
* @description: TODO
* @author ${USER}
* @date ${YEAR}年${MONTH}月${DAY}日
* @version: 1.0
*/
3. The apply save is completed
Two, idea method annotation
1. Create a custom group
2. Create a template
3. Set the template
method comment template
*
* //
* $param$
* @return $return$
**/
Generate template/** + template name + shortcut key,
4. Select the file to generate the template
choose java
5. Binding selection parameters
param code:
groovyScript("def result = '';def params = \"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {if(params[i] != '')result+='* @param ' + params[i] + ((i < params.size() - 1) ? '\\r\\n ' : '')}; return result == '' ? null : '\\r\\n ' + result", methodParameters())