Template Editor helps editing
Code Templates. It opens in a new
Visual Studio code pane, allowing you to switch between your code and
your template editing environment to make real-world testing of
templates faster:
The following two tables describe controls in the Template
Editor that can be divided into two logical groups:
- Template Options: general template controls above the text editor.
- Template Variables: the list of template variables to the right of the text editor.
Template options
| Item | Description | Comments |
|---|---|---|
|
Shortcut
Go to top |
In this field, you should specify the shortcut (abbreviation) that you can type in your source code to invoke a live template. |
Available for live templates. |
|
Description
Go to top |
For surround templates and file templates, this is the identifier that is displayed in drop-down lists when you attempt to choose and apply a template. For live templates, this is the description string that is displayed in drop-down lists to the right of a template shortcut. |
Available for all three types of templates. |
|
Default
file name
Go to top |
Type a default name that ReSharper will suggest in the Create [template description] dialog box when you apply a file template. |
Available for file templates. |
|
File name must be
a valid identifier
Go to top |
If this check box is selected and the default file name that you entered doesn't meet requirements for valid identifiers, ReSharper displays an error message in the Create: [name of template] dialog box when you attempt to apply a file template. |
Available for file templates. |
|
Available...
Go to top |
Shows the of the template applicability. By clicking the link, you can change scopes for the template using the Select Scopes dialog box. |
Available for all three types of templates. |
|
Shorten qualified
references
Go to top |
Select this check box if you want ReSharper to automatically remove redundant references in method calls for which necessary namespace import directives have been inserted. |
Available for all three types of templates. |
|
Reformat
Go to top |
Select this check box if you want ReSharper to automatically reformat the deployed template according to your code style settings. If the check box is cleared, ReSharper will only indent the whole template according to the code position where it was deployed, which leaves its formatting unchanged. |
Available for all three types of templates. |
Template variables
| Item | Description | Comments |
|---|---|---|
|
Name
Go to top |
In this column, names of template variables are initially displayed in the same order that they appear in the Template text section. You can move them up or down to alter the order in which ReSharper suggests values for variables when the template is applied. |
For more information, see Declaring Variables. |
|
Value
Go to top |
In this column, you can view or edit values and/or macros that ReSharper uses to suggest values when deploying the template. |
If a value is specified for the first time, this column offers to Choose Macro. Otherwise, it displays a link called Change Macro. See Choose Macro for details. |
|
Editable
Occurrence
Go to top |
In this column, you can define whether each template variable will have an associated input field during deployment, and where these input fields should be located. |
If a variable appears only once in the template code, this option is expressed by a check box. When this check box is selected, the corresponding field in the resulting code becomes editable. If a variable appears in the template code n times, this option is expressed by a drop-down box with the following possible choices:
|
|
Move Up
/
Move Down
Go to top |
Define the order of variables in a template by moving the variable rows up and down within the table. |
The order of variables specified in the table determines the order in which ReSharper suggests values for variables when the template is applied. |
