Jump Codes in CodeRush for Visual Studio

We've released a new navigation feature for CodeRush that helps you move to any code (in any programming language) that you can see onscreen (even code in code windows dragged onto other monitors) in just a few keystrokes. The feature also helps you select code blocks with the fewest keystrokes.

The feature is called Jump Codes, and here's how it works: 

  1. Look at the location onscreen (inside any visible code window) where you would like to move.
  2. Press Caps+Tab to bring up the JumpCodes UI (enable Caps as a Modifier feature if needed).
  3. Enter the displayed jump code at the target location. 
  4. Press Enter to land the caret at the target.

Simple enough.

Caps+Tab to invoke, Enter to land the caret (and a jump code in between).

However, as you might expect from the CodeRush team, there is more power here, allowing you to cut, copy, select and get anywhere onscreen, using a ridiculously small number of keystrokes. The rest of this post will dive into that power.

Landing Variations

After entering your Jump Code, pressing Enter will land the caret on the left side of the active token. You can combine the Enter key with one or more keyboard modifiers for different landing results.

For example, if you want to select the token under the JumpCode, hold down the Shift key while landing (Shift+Enter). 

If brackets follow the token, hold down the Ctrl key while landing (Ctrl+Enterto place the caret inside those brackets.

If you want the caret on the right side of the token (or the right inside of the brackets), hold down the Alt key while landing (Alt+Enter).

And all of these modifiers work with each other. So for example, if you want to land selecting the text inside brackets to the right of a token, press Ctrl+Shift+Enter.

Using the Arrow Keys

You can change the active token (and the active line) using the arrow keys if you like. Left & Right activate the token on either side and the Up & Down keys activate the row above or below. The active token is emphasized and surrounded by a red rectangle.

Correcting Mistakes

If you unintentionally select the wrong row, you can press Backspace to return to the initial row selection mode.

If you have selected the correct row and have selected the wrong token, keep yours eyes on that token - it will tell you what keys to press to activate it.

You can also drop the Jump Codes UI and return to the code window and location where you started by pressing Escape.

Working with Multiple Visible Code Windows

If you are working with more than one visible code windows (e.g., floating TextViews scattered across multiple monitors), you can activate an inactive TextView by pressing the number key associated with any jump code on that view (all jump codes in a view will start with the same number key). 

You can also activate code windows by pressing Tab (and Shift+Tab) to cycle through them.

Landing at the End (or Start) of a Line

You can immediately land at the end of the active line by pressing Ctrl+End.

Similarly you can immediately land at the start of the active line by pressing Ctrl+Home. 

If you want to select the entire line, just combine one of these shortcuts with the Shift key (e.g., Ctrl+Shift+Home).

And you can always change the active line using the arrow keys or by entering a jump code.

Creating Selections

There are a few ways to create selections.

Land with the Shift Key

As mentioned earlier, you can hold down the Shift key whlle landing to select the token (Shift+Enter) or the line (Ctrl+Shift+Home). 

You can also select all the parameters in a method declaration or all the arguments passed to a method by activating the previous token (e.g., the method name token) and pressing Ctrl+Shift+Enter.

Selection Expand

You can press the CodeRush shortcut for Selection Increase (e.g., Ctrl+W or the Num Plus key) to immediately drop the Jump Codes UI and invoke Selection Expand starting at the selected token. You can continue to invoke Selection Expand as needed to shape the selection.

Dropping an Anchor

You can drop an anchor by pressing Space over an active token. This marks the end of the selection. An anchor icon indicates the anchored token. You can now enter a new Jump Code to indicate the other side of the selection. Pressing Enter when a token is anchored will land and create a selection running from the anchored token to the token that was active when you pressed Enter.

Anchored selections also work with CodeRush's Smart Cut and Copy (more details below).

Smart Cut/Copy

Jump Codes enhaces the behavior of a cut or copy operation to save you some steps. To see how this works, lets start with an example. Let's say you're inside a document near the bottom of the view and you want to copy some text from the top and paste it right where you are. Here's how you do that without reaching for the mouse:

  1. Caps+Tab
  2. Activate the token that starts the block you want to cut/copy (or create a selection with an anchor).
  3. Press the Copy key. The block will be copied and the caret will return to place where you were right before. 
  4. Press Paste.

This even works across different open code windows.

If you want to override CodeRush's Smart Cut/Copy and only copy or cut the active token, you can press Space before pressing the cut/copy key.

Smart Cut works in the same way, but it will also drop a transient marker at the cut location so you can return later if needed. This can be useful when moving or exchanging methods between two different locations in a single code window (or between two different code windows).

Highly Optimized Efficiency

Landing shortcuts are highly optimized and designed to get you get anywhere inside any code window you can see with the smallest amount of physical effort. So not only can you get anywhere using the fewest key presses, you do this with the shortest finger travel distance. That means for many locations your fingertips will stay on the home row. And a single letter key press on the home row is all it takes to move the caret to the beginning of most lines in view.

If you are working with a non-Qwerty keyboard layout (such as Dvorak or Colemak), you will want to select your keyboard layout on the Jump Codes Options page.

Scalable to Extremes

Developers know more than most that it doesn't make sense to place hard coded limits in your products. And the CodeRush team fully embraced the idea of Extreme Scalability in developing JumpCodes. JumpCodes works regardless of how tiny your font is or how many lines of code you have onscreen or how many editor views you have distributed across multiple monitors.

The steps are the same regardless of scale. You simply look where you want to be, enter the JumpCodes shown at that location, and you are done.

In scenarios where a screen contains more than 26 lines of code (or when a line contains more than 25 tokens), you may have to press a letter key more than once (for example, in extreme situations a jump code might look line "aaabb". In situations like this, just keep your eyes on the target and it will tell you what keys you need to press to activate it, even if you overshoot it.

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.