MOVE RESHARPER 9 F CODE
Go to the Code Editing | Code Cleanup | General options page and select Automatically run cleanup when saving a file. The default profile is also used for silent cleanup.
Select a cleanup profile that you want to apply on save and click Set as default. You can run any cleanup tasks - for example, reformat code - every time you save a file, to make sure that your edits always comply with your code style. If you want to enable auto-saving after cleanup, select Save after cleanup is applied to the whole file on the Code Editing | Code Cleanup | General page of ReSharper options ( Alt+R, O). If you need to save your modifications to a shared settings layer, make your modifications on the Code Editing | Code Cleanup page of ReSharper options, click Save To and then choose the desired settings layer.Ĭlick Run to clean code in the selected scope.īy default, files that are opened in the editor are not saved automatically after cleanup. Note that if you create or modify cleanup profiles in this dialog, your changes will be saved using the smart save logic. If none of the available profiles suits you, choose one of the existing profiles and click Duplicate to create a new custom profile. Use the area to the right of the selected profile to check the tasks included in that profile. In the Reformat and Cleanup Code dialog that opens, choose a cleanup profile to apply. Right-click anywhere in the text editor or right-click the selection and choose Cleanup Code in the context menu. Press Control+Alt+F or choose ReSharper | Edit | Cleanup Code. Set the caret anywhere in the file to clean up code in the file. Make a selection in the editor to clean up code in the selection. Select the scope where you want to clean up code: If necessary, you can edit the list of generated items on the Code Inspection | Generated Code page of ReSharper options ( Alt+R, O).
MOVE RESHARPER 9 F WINDOWS
By default, ReSharper provides the list of file masks and regions for generated code typically produced by Visual Studio (for example, Windows Form Designer-generated code). Make sure that you select the right set of cleanup tasks by choosing the right cleanup profile.Ĭode cleanup is not applied to generated code.
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. You can also set this profile to be used for the silent cleanup. Your newly created cleanup profile will be available in the Code Cleanup dialog when you are running code cleanup. For more information, see Manage and share ReSharper settings. If you want to create or edit other profiles before saving your modifications, click Done on the top of the page to temporarily remember modifications to the current profile.Ĭlick Save in the Options dialog 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 list.
The tasks of the selected profile become editable on the right. Select the newly created profile in the list of profiles. ReSharper will create a new cleanup profile with the same set of tasks as in original profile. Select one of the existing profiles on the left and click Duplicate on the top of the page. Go to the cleanup profiles settings page: Code Editing | Code Cleanup | Profiles. Select ReSharper | Options from the main menu or press Alt+R O. If you want to run code cleanup with the custom set of cleanup tasks, you need to create a custom profile and specify the set of desired tasks there.Ĭode cleanup settings, including custom profiles, can be shared with fellow developers to ensure uniform look and feel of your code (see Manage and share ReSharper settings for details). These profiles help in most cases but you cannot configure them.
MOVE RESHARPER 9 F FULL
There are three default profiles available out of the box:īuilt-in: Reformat Code that only applies code formatting preferencesīuilt-in: Reformat & Apply Syntax Style that applies code formatting preferences and code syntax styles.īuilt-in: Full Cleanup that applies all available cleanup tasks except updating file header. Code cleanup profilesĬode cleanup can have various configurations (profiles) to apply in different cases according to your needs. ReSharper allows you to apply formatting and other code style preferences in a bulk mode to instantly eliminate code style violations in one or more files, in a project or in the entire solution.įixing inconsistent naming is not included in code cleanup because when batch-applied it can lead to naming conflicts. You can also run code cleanup using the command-line utility.