All templates that you can find in the Templates Explorer window can be edited according to your needs and development practices. You can edit template body, change shortcuts for live templates and descriptions for all templates, change template scope, introduce or modify template parameters.
Before editing code templates, it is recommended to study the way ReSharper stores them. Not only different templates can be saved in different settings layers, but modifications to a template can be saved separately in another settings layer.
In most cases, you do not have to do anything about it; just leave the default Smart option in teh Layer selector. But there are cases when you have to select a particular settings layer. Some of these cases are described below.
For more information, see Storage of Templates.
If you are going to edit a template that is shared via the Solution team-shared settings layer or via other shared layer, there are two ways to do so:
If you want your changes to affect those who use the same settings layer, make sure to choose the layer where the template is defined in the Layer selector before you start editing.
To change the template for yourself and leave the shared version intact, choose Smart (which is the default option) in the Layer selector before you start editing.
If you intend to edit a predefined template, you can also use the distributed storage of templates to your advantage:
By default, the Smart layer is chosen in the Layer selector, so your changes will be saved into the This computer settings layer and the modified template will be available in all solutions on your computer.
It might be useful to record the changes to the predefined template in a particular settings layer, for instance in the Solution-personal layer, so that the modified version of the template only appears in this solution. To do so, choose the target layer in the Layer selector, click Filter Templates and choose Show predefined templates and then choose a predefined template that you want to edit.
To edit an existing template
In the Templates Explorer window that appears, click one of the tabs to choose the type of the template: Live Templates, Surround Templates, or File Templates.
- Optionally, to display and edit templates from a particular settings layer, choose this layer in the Layer selector.
In the Scopes area, click the scope that corresponds to the target template. You can also use categories to locate it.
Find the desired template in the right part of the Templates Explorer and click Edit on the toolbar or double-click the template.