我们知道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 ...
我的问题是如何在创建新文件时生成当前的类文件全名? e.g。
/**
* Created on 1/11/15.
* Class: MyApp.java
*/
答案 0 :(得分:1)
将类模板更改为以下内容:
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
/**
* Created on ${DATE}.
* Class: ${NAME}.java
*/
public class ${NAME} {
}
(作为个人评论,我没有看到任何用处,因为当你打开文件时,你已经知道它的名字;没有理由在评论中复制这些信息。)