Back to Devexpress

Move to Region

coderushforroslyn-119021-code-style-assistance-move-to-region.md

latest2.7 KB
Original Source

Move to Region

  • Jun 14, 2021
  • 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.

  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:

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.

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:

How to Open the Move to Region Menu

Do one of the following:

  • Use the Member Icon menu

  • Create a MoveToRegion command shortcut

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:

Option 2: Bind a Shortcut to the MoveToRegion Command

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

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

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

  4. Choose the MoveToRegion command from the list.

  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 ).

Configuration

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

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