After a template is expanded, its variables are presented in the editor as input fields. The values of these fields can be either filled in by the user or calculated by WebStorm.
To have it done automatically, for each variable you need to specify the following:
- Expression to be calculated in association with the variable.
- Default value to be entered in the input field if the calculation fails.
The order in which WebStorm will process input fields after the template expansion, is determined by the order of variables in the list.
Open the template settings, and in the Template Text area
click the Edit Variables button.
The Edit Variables button is enabled only if the template body contains at least one user-defined variable, that is, a variable different from $END$ or $SELECTION$.
The Edit Template Variables dialog box opens, where you can define how the variables will be processed when the template is used.
- In the Name text box, specify the variable name to be used in the template body.
- In the Expression drop-down list, specify the expression to be calculated by
WebStorm when the template is expanded. Do one of the following:
- Type a string constant in double quotes.
- Type a predefined function with possible arguments or select one from the drop-down list.
An argument of a function can be either a line constant or another predefined function.
- To enable WebStorm to proceed with the next input field, if an input field associated with the current variable is already defined, select the Skip if defined check box.
- To arrange variables in the order you want WebStorm to switch between associated input fields, use the Move Up and Move Down buttons.