I am trying to create my custom template with a custom variable called $MyName. And I think it should be possible for IntelliJ to ask about the variable\'s value if
File | Settings | Editor | File and Code Templates
You should set it in files. If set in includes, the new file is directly output variable name instead of variable content. For example, set the Java Class file Custom variable$DESCRIPTION.If the value of a variable is not defined in the template, IntelliJ IDEA will ask you to specify it when the template is applied.
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
/**
* Description: $DESCRIPTION
* Created by ${USER}
* Date: ${YEAR}/${MONTH}/${DAY}
* Time: ${TIME}
*/
public class ${NAME} {
}
you can also define the values of custom variables right in the template using the #set directive.
For example, if you want to use your full name instead of your login name defined through the predefined variable ${USER}, use the following construct:
#set( $MyName = "John Smith" )
It's a bug in IntelliJ IDEA, filed as https://youtrack.jetbrains.com/issue/IDEA-154958. Thanks for noticing!