IDEA settings document comments

IDEA settings document comments

1. Reference materials

  1. IDEA class and method annotation template settings (very detailed)
  2. Idea comment template configuration (hematemesis recommended!!!)

2. Class documentation comments

2.1, set the document annotation template

Set the documentation comment of the class on the [File and Code Templates] page

image-20200712164023373

/**
 *@ClassName ${NAME}
 *@Description  TODO
 *@Author ${USER}
 *@Date ${DATE} ${TIME}
 *@Version 1.0
 */

2.2, use class documentation comments

Note: Only when you create a new class , you can create the documentation comment of the class.

image-20200712164228773

3. Set interface documentation notes

3.1, set the interface document annotation template

In the same way, set the interface document comment on the [File and Code Templates] page

image-20210122112115886

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
/**
 *@InterfaceName ${NAME}
 *@Description  TODO
 *@Author Oneby
 *@Date ${DATE} ${TIME}
 *@Version 1.0
 */
public interface ${NAME} {
}

3.2, use interface documentation notes

Note: Only when you create a new interface , you can create an interface documentation comment.

image-20210122112100734

4. Method documentation notes

4.1, setting method document annotation template

  1. Create a new template in [Live Templates]

    image-20201223150613354

  2. By default, a new group named user will be created (I am too lazy to change the name)

    1. Abbreviation:*Means to input on the method *, and then press Enter to appear the method document comment
    2. Description: Add documentation comments for the method
    3. Template Text: template content
    4. Applicable in Java: Only effective in Java files

    image-20210107171754521

  3. Add default values ​​for variables on the template

    image-20201223151806326

  4. Template for method documentation

    ** 
     * @description: $description$
     $params$
     * @return: $returns$
     * @author Oneby
     * @date: $date$ $time$
     */ 
    
  5. paramsOf default value:

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

4.2, use method documentation notes

Nice~~~

image-20201223151840753

Guess you like

Origin blog.csdn.net/oneby1314/article/details/112980534