Idea设置类注释和方法注释模板
2018-05-15 本文已影响438人
SunnyMore
设置类注释
- Ctrl + Alt + S
- Editor -> File and Code Templates -> Includes
- 新增加一个File Header
- 配置如下:
/**
* <Description> <br>
*
* @author Sunny<br>
* @taskId: <br>
* @version 1.0<br>
* @createDate ${YEAR}/${MONTH}/${DAY} ${TIME} <br>
* @see ${PACKAGE_NAME} <br>
*/
Idea 支持的变量
This is a built-in template. It contains a code fragment that can be included into file templates (Templates tab) with the help of the #parse directive.
The template is editable. Along with static text, code and comments, you can also use predefined variables that will then be expanded like macros into the corresponding values.
Predefined variables will take the following values:
${PACKAGE_NAME} name of the package in which the new file is created
${USER} current user system login name
${DATE} current system date
${TIME} current system time
${YEAR} current year
${MONTH} current month
${MONTH_NAME_SHORT} first 3 letters of the current month name. Example: Jan, Feb, etc.
${MONTH_NAME_FULL} full name of the current month. Example: January, February, etc.
${DAY} current day of the month
${HOUR} current hour
${MINUTE} current minute
${PROJECT_NAME} the name of the current project
设置方法注释
- Ctrl + Alt + S
- Editor -> Live Templates
-
新增一个Template Group,如图
image.png -
新增一个mc的live template,如图
image.png - 具体模板,如下:
/**
* Description <br>
*
* @author Sunny <br>
* @taskId <br>
* @param $METHOD_PARAM$ <br>
* @createDate $Date$ $Time$<br>
**/
image.png