Rider Help

Refactorings

Rider provides an extensive set of automated solution-wide code refactorings that allow you to rename, move, and safely delete symbols; introduce and inline fields, variables, or parameters, and carry out many more transformations painlessly.

Refactorings are available for most of the supported languages and project items. To learn more about specific refactorings, study the following sections:

To perform a refactoring

  1. Set your caret at a symbol, select a code fragment that you want to refactor, or select an item in a tool window.
  2. Do one of the following:
    • In the main menu, choose Refactor, and then select a desired refactoring. The list of refactorings available in this menu depends on the current context. If Rider cannot suggest any refacrotings for the context, the entire menu is disabled.
    • In the main menu, choose  Refactor | Refactor This, or press Ctrl+Shift+R to display the list of applicable refactorings, and select one of them. You can also choose Refactor This in the context menu of a selection.
    • Use default keyboard shortcuts (Windows, Linux/ (macOs) assigned to specific refactorings, or assign custom shortcuts to your favorite refactoring commands.
  3. If the selected refactoring requires user input, the refactoring wizard opens. Note that the wizard's dialogs are not modal, so you can edit the code while the wizard is open.
  4. If a refactoring operation would cause code conflicts (such as duplicate names, visibility conflicts, etc.), the wizard displays the list of conflicts on the last step, before you apply the refactoring. For some conflicts, the wizard can also suggest quick-fixes. For more information, see Resolving Conflicts in Refactorings.
  5. Right after the refactoring has been completed, all changes that it makes anywhere, including other files, are registered as a single operation. So you can use the Undo action (Ctrl+Z) to roll back all these changes with a single keystroke.

Some refactorings are available immediately after you modify code in the editor. For more information, see Inplace Refactorings

You can use the following shortcuts to invoke refactorings:

CommandShortcut
Refactor This... Ctrl+Shift+R
Change Signature... Ctrl+R, S
Inline... Ctrl+R, I
Move... Ctrl+R, O
Method... Ctrl+R, M
Field... Ctrl+R, F
Parameter... Ctrl+R, P
Variable... Ctrl+R, V
Rename... Ctrl+R, R
Safe Delete... Ctrl+R, D

For the full list of Rider keyboard shortcuts, see Keyboard Shortcuts Reference.

Last modified: 11 October 2017

See Also