A template consists of plain text with optional variables that convert into fields when a template is applied. A template variable has the following format:
where variable_name represents an arbitrary identifier. When the format is correct, the variable in shown in dark red in the template text: $variable_name$
The following template variables are predefined in ReSharper:
- $END$: Denotes the final caret position after the template is expanded and the user exits the template editing mode.
- $SELECTION$: Denotes the text selected by the user before requesting the template expansion. This variable is only user with surround templates.
- $SELSTART$: Denotes the starting position of the text block that will be selected after the template is expanded. The caret will be set in this position after expanding (even if the $END$ variable is present).
- $SELEND$: Denotes the ending position of the text block that will be selected after the template is expanded.
To make ReSharper automatically suggest values for variables in template input fields, you can supply your variables with predefined values and/or with macro-rules for calculating them.