IDEA add comments template

1, the new class, the interface is automatically generated annotation template

File -> Setting -> Editor -> File and Code Templates, File Header modify the following contents:

/**
* $END$
* @author alan
* @date  ${DATE} ${TIME}
* @version 1.0
*/

 

 

2, manual trigger template

Editor -> Live Templates:

Create a Live Template

Note Templates 1) class

 

/**
 * $START$
 * @author alan
 * @date  $date$ $time$
 * @version 1.0
 */

 

 Pay attention to modify the scope of the trigger:

 

 Then to define the variable value :( click Edit variables)

 

 

Notes Template 2) methods

/**
 * $START$
 * @author alan
 * @date $date$ $time$
$params$ $return$
 */

 

 params correspond script:

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 the corresponding script:

groovyScript("def returnType = \"${_1}\"; def result = ''; if(returnType != 'void'){result = '\\n * @return  ' + returnType}; return result;", methodReturnType());

 

Guess you like

Origin www.cnblogs.com/lkc9/p/11647066.html