- Open Preferences, click Live Templates, first add a Template Group, named Define, the results are as follows:
- Select the Define that you just created, choose to add Live Template, and then add the following information to the Template. The Abbreviation attribute is very important. You need to use this value when you annotate the method, so don't write too complicated, simpler is best, and then Template Text is the template format customized by the annotation method:
- After completing the above information, click the fifth step and select java as follows:
- Finally, select the operation to trigger the custom template, usually using the Enter key, so click Expand with and select the Enter option, as follows:
- Finally, configure the parameter value expression in the lower template, click Edit variables, and maintain the expression as follows:
Finally select apply to make the configuration take effect.
Test the effect:
On one method, enter **/ a as follows:
Click Enter, and the result is as follows:
You can find that the custom comment is effective. The following provides a reference template:
(此处注意留空一行)
* @Description: TODO
* @Param: $param$
* @Return: $return$
* @Author: 用户名
* @Date: $time$
**/