ReSharper 2021.1 Help

Edit Templates

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 the 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 Themed icon filter screen gray and choose Show predefined templates and then choose a predefined template that you want to edit.

Edit an existing template

  1. In the main menu, choose ReSharper | Tools | Templates Explorer….

  2. 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.

  3. Optionally, to display and edit templates from a particular settings layer, choose this layer in the Layer selector.
  4. In the Scopes area, click the scope that corresponds to the target template. You can also use categories to locate it.

  5. Find the desired template in the list and click Edit Themed icon edit screen gray on the toolbar or double-click the template. use the controls below the list to modify the template as described in the Create a Live/Surround Template section.

  6. When the template opens in the Template Editor, modify it as described in the Create a Live/Surround Template section.

Last modified: 08 March 2021