Rory Becker - DevExpress CodeRush Blog

CodeRush for Roslyn: The References Toolwindow

The CodeRush References tool window is a wonderful thing.

Place your caret on a symbol and press Shift+F12 asking the question: “Where else is this used?”.
Next: Navigate the results with the Arrow Keys and Hit Enter to visit the selected reference.

Consider an example search for all the references to LightweightControlCollection in OpenLiveWriter:

The VS version of this is ok, but it’s very black and white and isn’t exactly very configurable. 50% of the screenshot below is taken up with the name of the file the code was found in.

image

Compare this with CodeRush version and I think you’ll agree, we improved things a lot.

A Brighter Outlook

The first thing you’ll notice about CodeRush’s presentation is the introduction of color. In the image below I have stripped away all the hierarchical feature of CodeRush. Even without all of that useful information, you’ll note that it is still easy to pick out XML Doc comments from class declarations, instantiations and constructors. These days we code in color because it helps us discern additional information about the code and the way the compiler sees it. Why should our search be limited to just black and white?

image

Hierarchy

Despite the addition of color, there is still a lot of information to absorb in a list like this. Wouldn’t it be better if we could group the information in some sensible way?

Well CodeRush has you covered there as well. These 5 toolbar buttons imageallow you to specify which levels to group your references by. From left to right they are: Project, File, Namespace, Type and Member. They can all be toggled independently and provide additional collapsible parent nodes for your results.

ReferencesWithProjectAndType

You have complete control over the level of hierarchy you use. See above how I have chosen to use Project and Type nodes in my hierarchy. This immediately expands the amount of horizontal space allocated to the code, rather than the naming of the file in which it sits. Just take a moment to compare this image with the first one.

Preview

You can also elect to view a preview of the location of the selected item. Use the following icons image to select between a preview on the right of your results, one beneath or no preview.

ReferencesWithPreview

Filter by Usage

The icons next to each result reflect the type of usage. Either Reads, Writes or New Instances. If you so choose, you can filter your results by the type of their usage. The drop down box in the toolbar will allow you to filter by ‘Reads’, ‘Writes’, ‘New Instances’, or ‘All Usages

image

See how the ‘New Instances’ choice reduces my previous list to only 2 entries.

ReferencesFilteredByNewInstances

Filter by Text

You may also filter the items in your results by text. Text entered in the Search box image will cause CodeRush to remove all items that do not contain that text within their entry. See below how I have filtered by the word ‘index’ and removed all but those with this text present.

image

Refresh and New Search

There are 2 final icons that should be explained. image

The first of these is Refresh. The entries in the References tool window do not update as you alter code. They reflect the state of the code at the moment you engaged the feature. Pressing the Refresh button will execute the original search update the results in the current Tab.

The second icon is New Search. When pressed, it will leave the existing results in place, and create a new Tab based on the original search criteria. This means that in the new Tab, the Usages drop down will be reset to ‘All Usages’ and the ‘Search’ box will be cleared.

Each new activation of the References tool window via the Shift+F12 key will cause an additional Tab to be created, allowing you to keep many sets of results active at once.

The References ToolWindow has never been better. It’s fast, clear and colorful in a meaningful way. With the ability to filter it’s results as well as arranging those results with the hierarchical elements you choose.

If you’ve not already got your copy of CodeRush, you can find a preview here on the Visual Studio Gallery

Published Jun 07 2016, 08:41 PM by
Bookmark and Share

Comments

Daz

Please pass on the merits of colour to the rest of DX.  A little part of me dies every time I see the mono icons in the toolbox and have to read each control to find the one I want instead of scanning for the previously recognisable icon.

June 8, 2016 12:30 AM

Ertan ERTEM

Looks very handy.

June 14, 2016 6:34 AM

Crono

This is brilliant! Can't wait to use it! :D

June 14, 2016 12:00 PM

Vito (DevExpress Support)

We have just released CodeRush for Roslyn v16.1.4, containing this functionality.  It is available through Visual Studio Gallery:

visualstudiogallery.msdn.microsoft.com/8a8390ae-1f71-4659-9d8d-5dd56fd8a72e

June 23, 2016 8:59 AM

Kevin O'Donovan

Any idea when tab to next reference is likely to be introduced?

June 28, 2016 7:03 AM

Rory Becker (DevExpress)

Hi Kevin

You'll be pleased to know it's already in. It has been for a number of releases by this point.

I personally couldn't do without it :)

June 28, 2016 7:39 AM
LIVE CHAT

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

FOLLOW US

DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2017 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners