How IntelliJ IDEA sets class annotations and method annotations

1. Class Notes

method 1

Open file -> setting -> Editor -> Filr and Code Templates -> Includes -> File Header,
edit the content you need to comment in the file box on the right, click save; when you create a class, the comment will be automatically generated.

Method 2

Open file -> setting -> Editor -> Filr and Code Templates -> Files->Class,
add the content you want to comment on the class name on the right, click save; when you create a class, the comment will be automatically generated.

commented code

/**
    * @ Author:  songy
    * @ Date  :  ${TIME} ${DATE}
*/

Verify

2. Method Notes

1. Open file -> setting -> Editor -> LiveTemplates,
click the green + sign on the top right, select Template Group and double-click, then a window pops up, add a name, I added "MyGroup" -> OK

2. Under the path of file -> setting -> Editor -> LiveTemplates,
click the name you just added (that is, the newly created "ZJWGroup"), then click the green + sign on the top right, select LiveTemplate, and fill in the following The abbreviation of "Abbreviation" in the box on the figure
(after typing this abbreviation, such as "cmt", press "tab" and the comment will appear automatically), "Description" description, "Templete text" comment template

3. Click "Define" to select the scope of the template


4. Click the Edit variables button in the lower right corner, and a window will pop up, as follows:


5. Click apply -> ok to save

6. Verify

Guess you like

Origin blog.csdn.net/songyun333/article/details/127664693