In this post, I’m going to show you some of the types of notification that you might see within CodeRush. Let’s start at the beginning…
The ‘Welcome’ dialog is the screen you see when you start CodeRush for the first time.
It asks you 2 things:
- Are you a new user?
- Would you like CodeRush to load automatically in future?
The default answer to both of these is yes. So if this suits you, simply click Ok.
New Users are treated to explanations of CodeRush functionality, as it occurs via the ‘What happened’ popup.
The “What happened” popup is a notification that only presents itself, if you previously asked to be considered a ‘new user’ from the ‘Welcome’ dialog (above)
It’s purpose is, as the name implies, to explain what just happened.
Let’s demonstrate with a small example.
Image you have the following line of code in a method:
var Fred = 6;
Place your caret on the line of code, and hit Shift+Enter. The line of code is duplicated beneath the original, and CodeRush highlights the name of the variable for you so that you can give this new variable a different name.
In addition, the ‘what happened popup’ appears to let you know what happened.
It tells you the name of the operation that happened ‘Duplicate Line: Local Variable’ explaining this particular duplication has duplicated a locally initialized variable.
It gives you 3 options: ‘Ok’, ‘Disable’ and ‘Options’.
- If you like what CodeRush did, and would prefer it to continue doing so without popping this screen up next time, click ‘ok’.
- If instead you don’t like what you saw, click ‘Disable’ and CodeRush will not perform this operation next time the shortcut in question is triggered.
- Finally if you’d like to visit the options for the item in question, click ‘Options’ and not only will you be take to the correct page of the options screen, but CodeRush will also select the item in question (in this case ‘Local Variable’) from the available list of options.
Although the ‘What happened’ popup appears to give you only 3 options, there is another alternative. You can simply ignore the popup and keep on typing.
In this case you can change the name of the newly generated variable to something else, and as you do so, the ‘What happened’ popup simply disappears. This is an example of CodeRush avoiding the use of modal dialogs and letting you continue to code without getting in your way.
Sometimes the use of a shortcut will trigger CodeRush functionality instead of some VS functionality which you might have been expecting.
For example: If you use ‘Esc’ key to ‘Collect Marker’ (Previously dropped using the ‘Alt+Home’ key combo)...
…the ‘What happened?’ popup appears to let you know that CodeRush has suppressed Visual Studio’s ‘SelectionCancel’ command, in favour of ‘Collect Marker’.
As expected your options are summarised in the body of the ‘What happened?’ popup.
- If you’d like CodeRush to continue to do it’s thing under these circumstances, click ‘Always do this’.
- If you’d prefer CodeRush to take a back seat and have Visual studio perform ‘SelectionCancel’ instead, then choose the bottom option.
- If you like to change either of the bindings so that they don’t conflict in this way, CodeRush offers you some links to the appropriate screens from which this can be done.
As before you can simply ignore this dialog for now, by continuing to type.
Sometime CodeRush has more information to offer you about what happened.
In the case of a template expansion, you’ll be treated to at least a partial view of the expansion that occurred, and the exact name of the template which was expanded. Additionally the ‘Template Options’ link will load up the options screen at the exact template that was expanded back in the editor.
If you wish to do so, you can disable the ‘What happened?’ popup from the options screen (Ctrl+Shift+Alt+O), choose the ‘Core\Features’ page and then un-tick the first checkbox.
Action hints are arrows drawn on screen to alert you to something that CodeRush did, which might not be obvious at first glance.
The previously mentioned Duplicate line and Template Expansions (at least the smaller ones) are good examples of this.
Action hints have built in natural limits and will only display a pre-set number of times for each operation, before auto-disabling themselves. If you’d like to re-enable these or prematurely disable them, this can be done from the Options screen (Ctrl+Shift+Alt+O) on the ‘Hinting\Action Hints’ page. This page is only visible if the level dropdown is set to ‘Advanced’ or higher.
Big Hints are large tool tips that describe the currently active feature. These are especially useful for explaining the effect of an item on the ‘Refactoring’ or ‘Code’ Smart Menu, prior to actually clicking it.
Simple examples include Create Setter Method and Encapsulate Method.
A more complex example is the Extract Method refactoring.
This refactoring analyses the highlighted section of code and calculates extracts this code into a separate method. In order to do this, it needs to figure out what parameters and return type such a method would need.
The ‘Big Hint’ includes this information in order to help you decide if you truly want to extract the code you’ve got highlighted, or if you’d prefer to extract something slightly different.
Here the same ‘Big hint’ is shown for 2 potential extractions. See how the hint reconfigures itself to show what sort of parameters will be created.
Big hints are controllable from the ‘Hinting\Big Hints’ options page. This page is only visible if the level dropdown is set to ‘Advanced’ or higher.
Billboard hints occur when you cancel interactive phases that permit typing in the editor. A good example of this is when you invoke the Add Parameter refactoring, then leave the line before specifying any new parameter details and press Enter on another line. At this point you should sees a billboard message telling you that the Add Parameter refactoring was cancelled.
Billboard messages can be controlled from the ‘Hinting\Billboard Messages’ options page. This page is only visible if the level dropdown is set to ‘Advanced’ or higher.
These simple popups provide you with a list of available shortcuts for the current operation.
Examples of said operations include ‘Tab to Next Reference’ or the ‘Reorder Parameters’ refactoring.
To dismiss this screen, click the blue ‘minimize’ icon. Alternatively to disable this feature, click the red ‘close’ icon.
Suppressed Shortcut hints can be re-enabled or the whole feature disabled from the ‘Hinting\Shortcut Hints’ options page.
This page is only visible if the level dropdown is set to ‘Advanced’ or higher.
This post is meant to give you a small taste of the types of notification that you might see in CodeRush as it attempts to better inform you as to what is happening.
There are several more and indeed they are described far better in the Official CodeRush Documentation.
So once you’re ok with those presented here, feel free to go check out some of the others