File Template Custom Variables

I'm having a heck of a time understanding how one goes about creating custom variables for use in file templates.  I created a new variable in a template called ${MYVAR}, but how do I go about defining that variable and what content goes into it?  I read the docs but the content for this specific topic is very thin.  Any help would be appreciated.

Doug

5 comments

Hello Doug,

If you define a custom variable, a dialog will be shown when you create a

file from that template, prompting you to specify the value of the variable.

I'm having a heck of a time understanding how one goes about creating

custom variables for use in file templates.  I created a new variable

in a template called $, but how do I go about defining that

variable and what content goes into it?  I read the docs but the

content for this specific topic is very thin.  Any help would be

appreciated.

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0

It's not prompting me for the value.  I've modified the default 'Python Script' file template and added ${MYVAR}.  I then create a new python file in my project and it doesn't prompt for the value.  Am I missing something?

Doug

0

I have the same problem in PHPStorm.

My template for PHP file is:

#parse("PHP file header.php")

Include PHP file header.php is:

<?php

/**

* @package ${package}

* @author ${user}

*/

Class template is:
#parse("PHP file header.php")
#parse("PHP class header.php")
class ${NAME} {
}

Include PHP class header.php is:

/**

* @package ${package}

* @author ${user}

*/

But these variables aren't expanded (and there is no prompt for their values too) neither during new file creation nor class creation.

0

Hi,

I had the same problem trying to change the default "Python Unit Test" template and using undefined custom variable. I solve the problem by creating a new template and now the value of custom variable is asked at the same time than the filename.

0

Please sign in to leave a comment.