Creating Files from Templates
Ctrl+Alt+Insert
ReSharper_GenerateFileBesides
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.
To create a new file from template
- Do one of the following:
- On the main menu, choose or press Ctrl+Alt+Insert.
- 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.
- If you have chosen More, the Choose Template dialog box appears, where you can select a required template. To optionally introduce a template into the quick access list, select its entry in the Choose Template dialog box and tick the Add to quicklist check box in the lower part of the dialog box before clicking OK.
- In the Create: [name of template] dialog box that appears, specify the name for the new file and click OK.
- The newly created file is added to the selected place and opens in the editor (in case of multi-file template, several files will be created and opened).
-
If the template has
editable parameters
(i.e. requires user input), ReSharper deploys a
Hot Spot Session in the editor and sets the input position at the first parameter.
Then you can do the following:
- If ReSharper suggests some values for the current parameter, use Up and Down arrow keys to navigate through the list of suggested values, or just type in a desired value.
- Press Tab or Enter to accept the value and move to the input position of the next parameter. If this is the last parameter, the hot spot session completes and the caret moves to the end position defined for the session.
- Press Shift+Tab to move the input focus to the input position of the previous parameter.
- Press Esc to exit the hot spot session. In this case, all session parameters will be initialized with default values.
This feature is supported in the following languages/technologies:
C# | VB.NET | C++ | HTML | ASPX | Razor | JavaScript | TypeScript | CSS | XML | XAML | RESX | Build Scripts | Protobuf | JSON |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.
See Also
Concepts:
Procedures:
Reference:
Last modified: 19 August 2016