Skip to main content

Move to Region

  • 3 minutes to read

This feature allows you to move a member or type to the desired region. This task includes the following steps:

  1. Open the Move to Region menu.

    See the following section for more information: How to Open the Move to Region Menu.

  2. Select a target region from the Move to Region menu and press Enter.

In the screencast below, Move to Region is used to move the “field3” private field to the “Private fields” region:

Move to region

If you know the name of an existing region, you can type it in the Move to Region menu. CodeRush shows this region in the list.

Move to Region Filter

Note

The Move to Region menu shows regions in the same order they appear in code.

If a target region does not exist for a selected member/type, the Move to Region feature can create it and embed a selected member/type to this region. To do this, follow the steps below:

  1. Open the Move to Region menu for a selected type/member.

  2. Type a target region name.

  3. Choose the newly-created item from the list and press Enter.

In the screencast below, Move to Region embeds the “field3” public field into the newly-created “Public fields” region:

Move to New Region

How to Open the Move to Region Menu

Do one of the following:

  • Use the Member Icon menu

    This technique requires that you enable the Member Icons feature first. For more information, refer to the following topic: Member Icons.

  • Create a MoveToRegion command shortcut

    Bind a shortcut to the MoveToRegion command on the Shortcuts options page.

Option 1: Use the Member Icon Menu

  1. Enable the Member Icons feature.

  2. Click the icon on the left of a desired member/type and select the Move to Region item:

    MoveToRegion

Option 2: Bind a Shortcut to the MoveToRegion Command

  1. Choose the CodeRush | Shortcuts… menu item to open the Shortcuts options page.

    Shortcuts Menu Item

  2. Select a desired shortcut in the shortcuts folder or create a new one.

    To create a new shortcut, click the Add a new shortcut toolbar button.

    Shortcuts Menu Item

  3. Specify a shortcut in the First shortcut text box. In this example, the shortcut is Ctrl + J.

    Click the ellipsis button to add special keys (for example, Delete or Tab) or modifiers (Ctrl, Alt, and so on) to your shortcut.

    Shortcuts Ellipsis Button

  4. Choose the MoveToRegion command from the list.

    MoveToRegion Shortcut Settings

  5. Click Apply and OK to save the shortcut configuration and close the Shortcuts options page.

  6. Place the caret in the required member/type. Then, press your shortcut to open the Move to Region menu (in this example, Ctrl + J).

    Move to region

Configuration

You can configure the Move to Region feature on the Editor | All Languages | Move to Region options page.

Move To Region Settings

For more information, see the following topic: Move to Region Settings.