A View Inside My Head

Jason's Random Thoughts of Interest


CodeRush: CodeRush Tool Window

CodeRush is full of templates.  Thousands of them, when you combine the basic templates with the various types that are supported by each.  How does someone start to learn all of the required mnemonics in order to use CodeRush effectively?

The answer to that is a brilliant feature known as the CodeRush Tool Window:

DevExpress, Tool Windows, CodeRush

(DevExpress menu in Visual Studio, Tool Windows -> CodeRush)

The CodeRush Tool Window provides a context-sensitive list of "next characters" in CodeRush templates that are valid at the cursor's current location.  As you start to work with CodeRush, leave this window open (perhaps on a second monitor) so that you can train yourself.

CodeRush Tool Window docked on the left

In the screenshot above, I have the CodeRush Tool Window docked on the left side of my IDE.  Depending on where my cursor is located, the contents of the window will change.

For example, I can create a new Auto-Implemented Property at the cursor's current location (line 49 in the screenshot).  In the CodeRush Tool Window, I see that mnemonics for Auto-Implemented Properties start with "a", so I can type that character.  But, after typing "a", the contents of the CodeRush window will change:

CodeRush Tool Window after starting a mnemonic

The letter "a" by itself is a valid mnemonic for a CodeRush Template, as indicated by the the green "expansion" frame at the top of the CodeRush Tool Window.  If I were to hit the spacebar here, I'd get code for a new abstract class (a preview of this code appears in the expansion frame).  This is not what I want, so I can look in the list to see if typing more characters results in an appropriate mnemonic.  Note: If you do accidentally expand a wrong template, just perform an Undo (Ctrl-Z) to return to the pre-expansion state of your code.

Suppose that I was trying to create an Auto-Implemented Property of type Boolean.  From the contents of the window, I see that "ab" is listed as "bool", and so I only need to type the second character ("b") and then hit the space bar.

Play around by moving your cursor to various places in your code, and observing how the contents of the CodeRush Tool Window changes.  Try out some of the template mnemonics that are listed to see how they work.  Remember that Undo (Ctrl-Z) will get you back to where you started.

Happy Coding!