ReSharper can reformat an arbitrary selected block of code, all code in the current file, all files in a directory, the current project, or even the current solution. Reformatting is performed according to your Code Style Settings.
To perform code reformatting:
- If you want to reformat a block of code, select it first.
- To start code reformatting, do one of the following:
The Reformat Code dialog is displayed:
- press Ctrl + Alt + F;
- select ReSharper | Code | Reformat Code in the main menu;
- right-click in the code editor and select Reformat Code from the shortcut menu;
- right-click on a file, folder or solution node in Solution Explorer and select Reformat Code.
- Select additional options as required and click Reformat .
- Optimize "using" directives - redundant "using" directives will be removed from the selected code. See Optimize Using Directives.
- Shorten references - redundant qualifications before type names will be removed (redundancy of qualifications is determined according to the present "using" directives). See Optimize Using Directives.
- Remove redundant 'this.' qualifier - redundant 'this.' qualifiers will be removed.
- Arrange modifier keywords - forces modifier rearrangements according to your Code decoration preferences.
- Keep modified files open - ReSharper will open the modified files in new editor tabs, and then you will need to save the changes yourself. Clear this check box if you want ReSharper to save the changes automatically, without opening the files.
Note To performed code reformatting and bypass the dialog shown above, press Shift + Ctrl + Alt + F. The options used last time will be applied.
Advanced Editing Features | Optimize Using Directives | Code Style Settings