Refactorings
JetBrains 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. For more information about specific refactorings, study the following sections:
Perform a refactoring
Place the caret at a symbol, select a code fragment that you want to refactor, or select an item in a tool window.
Do one of the following:
In the main menu, choose
, and then select a desired refactoring. The list of refactorings available in this menu depends on the current context. If JetBrains Rider cannot suggest any refactorings for the context, the entire menu is disabled.In the main menu, choose Refactor This in the context menu of a selection.
, or press Control+Alt+Shift+T to display the list of applicable refactorings, then select one of them. You can also chooseUse default keyboard shortcuts (Windows, Linux/ (macOs) assigned to specific refactorings, or assign custom shortcuts to your favorite refactoring commands.
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.
If a refactoring operation would cause code conflicts (such as duplicate names, visibility conflicts, and so on), 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, refer to Resolve conflicts in refactorings.
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 Control+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, refer to Inplace refactorings
You can use the following shortcuts to invoke refactorings:
Control+Alt+Shift+T | |
Shift+F6 | |
Control+F6 | |
Control+Alt+N | |
F6 | |
Control+Alt+M | |
Control+Alt+F | |
Control+Alt+P | |
Control+Alt+V | |
Alt+Delete |
For the full list of JetBrains Rider keyboard shortcuts, refer to Keyboard shortcuts in predefined keymaps.