IntelliJ IDEA创建后如何生成当前文件头注释
How to generate current file header comment after creation with IntelliJ IDEA
据我们所知,IntelliJ 支持代码模板
Settings path: Editor > Code Style > File and Code Templates
通过 IntelliJ 预定义变量很容易生成一些默认的文件头注释,
${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
etc ...
我的问题是如何在创建新文件时生成当前 class 文件全名?例如
/**
* Created on 1/11/15.
* Class: MyApp.java
*/
将 Class 模板更改为如下内容:
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
/**
* Created on ${DATE}.
* Class: ${NAME}.java
*/
public class ${NAME} {
}
(作为个人评论,我认为这没有任何用处,因为当您打开文件时,您已经知道它的名称;没有理由在评论中重复此信息。)
据我们所知,IntelliJ 支持代码模板
Settings path: Editor > Code Style > File and Code Templates
通过 IntelliJ 预定义变量很容易生成一些默认的文件头注释,
${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
etc ...
我的问题是如何在创建新文件时生成当前 class 文件全名?例如
/**
* Created on 1/11/15.
* Class: MyApp.java
*/
将 Class 模板更改为如下内容:
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
/**
* Created on ${DATE}.
* Class: ${NAME}.java
*/
public class ${NAME} {
}
(作为个人评论,我认为这没有任何用处,因为当您打开文件时,您已经知道它的名称;没有理由在评论中重复此信息。)