How to set the comment template for idea, with super detailed explanation with pictures and texts

Table of contents

First open the idea settings

1. Idea class comments

1. Find the following settings

2. Set the template

3. The apply save is completed

Two, idea method annotation

1. Create a custom group

2. Create a template

3. Set the template

4. Select the file to generate the template

5. Binding selection parameters

6, complete ok


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())

6, complete ok

Guess you like

Origin blog.csdn.net/m0_48804394/article/details/126955860