Skip to main content
A newer version of this page is available. .

How to: Assign a Keyboard Shortcut to a Refactoring

CodeRush supports the ExecuteRefactoring command that runs a specific refactoring without invoking the Code Actions menu.

Follow the steps below to bind the "Ctrl+Shift+3" shortcut to the ExecuteRefactoring command:

  • Choose CodeRush | Shortcuts... from Visual Studio's menu to open the Shortcuts configuration page.

    Config_Shortcuts_Access

  • Click New Shortcut to create a new shortcut.

    Config_Shortcuts_New

  • Specify the "Ctrl+Shift+3" shortcut in the "First shortcut" text box, and another shortcut in the "Second shortcut" text box (optional).

    First Shortcut

  • Choose ExecuteRefactoring from the "Command" combo box.

    Command

  • Type the name of a refactoring in the "Parameters" text box. In this example, the Extract String to Resource refactoring.

    Parameter

    You can find names of supported refactorings on the Editor | Language | Code Actions | Code Actions Catalog options page.

    Catalog

  • Click OK to apply the changes and close the Shortcuts options page.

  • Open the code editor and press the shortcuts key ("Ctrl+Shift+3" in this example) to run the ExecuteRefactoring command.

    Run