Running Code Cleanup
Ctrl+Alt+F
ReSharper_CleanupCode
ReSharper can apply code cleanup to an arbitrarily selected block of code, all code in the current file, all files in a directory, the current project, or even the current solution. Make sure that you select the right set of cleanup features by choosing the right cleanup profile.
To apply Code Cleanup in the selection or in the whole file
- Select the scope where you want to cleanup code:
- Do one of the following:
- In the Code Cleanup dialog box that opens, go to the Available Profiles area, select a profile to apply to your file or selection. You can glance through settings of a selected profile in the Selected Profile Details area. (If none of the suggested profiles suits you, click Edit Profiles to create a custom profile.
- Click Run.
You can clean up not only an individual file, but also multiple files in a directory, project or entire solution. To do so, you should run code cleanup from the Solution Explorer.
To apply Code Cleanup in multiple files, projects, or entire solution
Silent cleanup
Ctrl+Shift+Alt+F
ReSharper_SilentCleanupCode
You can launch code cleanup in the silent mode - that is, without displaying the Code Cleanup dialog box. Since in this case you won't be able to choose a profile explicitly, you have to assign some cleanup profile to use for the silent code cleanup.
To assign a profile for silent Code Cleanup
- Choose in the main menu.
- Open the Code Cleanup options: ReSharper | Options | Code Editing | Code Cleanup.
- Select a profile in the Profile to use with silent cleanup drop-down list.
- Click Save to apply the modifications and let ReSharper choose where to save them, or save the modifications to a specific settings layer using the Save To drop-down list. For more information, see Managing and Sharing ReSharper Settings.