ReSharper Web Help

ReSharper enables you to create classes, interfaces, structs and other files based on file templates. Once created, a new file is added to your project and opens in the editor. The file contains source code specified in the template.

 Note

File templates use indentation defined by language-specific code style settings that you can configure in:
ReSharper | Options | Code Editing | [Language] | Formatting Style.

To create a new file from template using ReSharper menu
  1. On the main menu, choose ReSharper | Edit | New from Template.
  2. In the New from Template sub-menu, choose Class, Interface, Struct, etc. or a custom item (if available) in the quick access list. If you want to use a custom file template that was not added to the quick access list, select More.
  3. If you have chosen More the Choose Template dialog box appears, where you can select a required template. To optionally introduce a custom file template into the quick access list, select its entry in the Choose Template dialog box and select Add to quicklist in the lower part of the dialog box before clicking OK.
  4. In the Create: [name of template] dialog box that appears, specify the name for the new file and click OK.
  5. If the template is parameterized (i.e. requires user input), the editor switches to the template editing mode and suggests an input position for the first parameter. You can type an appropriate value, choose one of the suggested values, if any, or accept the default value suggested by ReSharper, and press:
    • Tab or Enter to move to the input position of the next parameter.
    • Shift+Tab to move the input focus to the previous input position.
    • Esc to switch off the template editing mode and move the caret to the end position defined by template developer. In this case, all parameters will be initialized with default values.

The next two procedures are similar to the one described above; they differ only in the way you invoke the quick acess list for file templates.

To create a new file from template in the Solution Explorer
  1. In the Solution Explorer, select a node where you want to create a new file from template.
  2. Press Alt+Insert or Ctrl+Alt+Insert to display a drop-down list of available file templates.
  3. Select a target template.
  4. Specify the name for the new file and click OK.
To create a new file from template in the Text Editor
  1. Press Ctrl+Alt+Insert to display drop-down list of available file templates.
  2. Select a target template.
  3. Specify the name for the new file and click OK.

 Tip

To get the most out of file templates, you can edit the existing file templates or create new file templates so that the set of your templates will best fit your development practices.

See Also

Concepts

Procedures

Reference

External Links