Archive

Author Archive

Clipboard Tools – Intelligent Paste

March 14th, 2011 Comments off

The CodeRush Intelligent Paste clipboard feature modifies the text from the clipboard before inserting it into the code editor. An action hint with the name of the expansion appears once the suitable expansion is triggered on the Paste (Ctrl+V) command.

For example, copying a field member into a clipboard and then pasting it on the next line will produce a read-write property for the field:

Before:

private int myValue;

Read more…

Code Templates – Comments

March 10th, 2011 9 comments

Here is the list of CodeRush comments-specific code templates. The templates below generate comments for code areas, tasks, and a few others (miscellaneous). Nearly all of these templates start with the “/” character (for CSharp) or ” ‘ ” (for Visual Basic). See these comments on the Editor | Templates options page in the Options Dialog.

To better understand template expansions, I recommend familiarizing yourself with a few common text commands that you can observe inside these expansions.

Read more…

Visualization – Comment Highlighter

March 10th, 2011 Comments off

Occasionally you may need to note a place in a source file that needs to be revisited later for correction or improvements. There are three standard codes used to designate such places: TODO, HACK and UNDONE. Visual Studio has the built-in Task List tool window, which shows the list of such comments. To open the list, go to View menu -> Task List:

Visual Studio Task List

Read more…

Code Issues visual presentation

March 5th, 2011 3 comments

CodeRush code issues technology highlights found issues right inside the Visual Studio code editor with different colors. There are two permanent bars with issue indicators to the left of the code editor, and to the right of the vertical scroll bar. The third optional bar is intended to view solution wide analysis statistics for files and projects. This bar appears at the bottom of the code editor, if enabled.

Read more…

Visualization – Line Highlighter

March 5th, 2011 Comments off

As the name says, the Line Highlighter feature visually indicates the current line in the Visual Studio code editor. Such a visual line indication allows you to quickly find where the tiny flashing text caret is. This is especially valuable for large screen resolutions. This is what it looks like:

Read more…

CodeRush Navigation providers list

March 5th, 2011 Comments off

Here is the list of navigation providers shipped with the latest CodeRush Pro version. Press the Ctrl+Alt+N shortcut inside the code editor, to see all available navigation providers in the current context. You can use the provider name to bind it to a particular shortcut key using the Navigate command.

Read more…

CodeRush Navigation providers engine overview

March 5th, 2011 Comments off

CodeRush Navigation Providers Engine is an extensible architecture that allows you to easily navigate inside your code structure and particular code fragments.

There are dozens of nav providers shipped with CodeRush. To see available navigation providers in the current context, press the Ctrl+Alt+N shortcut inside the code editor, and the “Jump to” popup menu appears:

Read more…

Code Issues – Nested code can be flattened

March 4th, 2011 2 comments

Cause:

This code issue shows a hint (suggestion) when the nested code structure can be simplified and unintended. This is allowed by converting conditional statements into a guard clauses.

The practical reason for this is that it simplifies your reading of the code and reduces the apparent complexity. There is no specific limit for the amount of nested code blocks, however, if you get your code nested too deep, most likely, it must be refactored. In some cases, it’s better to validate all of your input conditions at the beginning of a method and just bail out if anything is not correct. This follows the “fail fast” principle, and you really start to notice the benefit when you have lots of conditions. You can have a series of single-level if-statement checks that check successively more and more specific things, until you’re confident that your inputs are correct. The rest of the method will then be much easier to write and follow, and will tend to have fewer nested conditionals.

Sample:

CodeRush Nested Conditional Can Be Flattened Fix

How to fix:

Apply the Flatten Conditional refactoring:

CodeRush Nested Conditional Can Be Flattened Fix

—–
Products: CodeRush Pro
Versions: 12.1 and up
VS IDEs: any
Updated: Nov/12/2012
ID: C074