ReSharper 2024.3 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, refer to 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 ThemedIcon.Filter.Screen.(Gray).png and choose Show predefined templates and then choose a predefined template that you want to edit.

Edit an existing template

  1. From 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 ThemedIcon.Edit.Screen.(Gray).png on the toolbar or double-click the template.

  6. When the template opens in the Template editor, modify it as described in the Create a live/surround template section.

Last modified: 11 February 2024