CodeRush for Roslyn – Setup Wizard

Everyone is different. Everyone has their own preferences and their own approach.

If you’ve never used CodeRush before (or even if you have) its a good idea to use our new setup wizard to configure things at a high level, before diving into your next coding session.

The wizard will give you the chance to set base settings for several of our main features, so that they behave the way you’d like them to. There is no requirement to use the wizard, but we feel that doing so will improve your CodeRush experience greatly.

So what can you configure using the wizard?

Structural Highlighting

CRRSetupWizardStructuralHighlightingWhat is it?
Structural highlighting is where CodeRush lines are drawn between the start and end of various different types of block. This helps make sense of what is commonly called arrow code (Code which is heavily nested in successive blocks of different type). By using different colors to show the the blocks of ‘properties’, ‘accessors’, ‘foreach loops’, ‘conditional blocks’, ‘switch statements’ and ‘exception handling blocks’, CodeRush makes it much easier to determine very quickly where each of these start and end.

What can I configure?
The wizard options here are simple: Would you like Structural highlighting on, or off?

What if I need more?
The ‘Editor\Painting\Structural Highlighting’ section of our options screen (Ctrl+Alt+Shift+O) will let you change which block types are linked, their color and style.

Numeric Keypad Bindings

CRRSetupWizardNumericKeypadWhat is it?
Put simply this option causes CodeRush to assign a few additional shortcuts to the keys of your numeric keypad. This keypad goes unused by the majority of people and this option will reclaim several of it’s keys for quick access to some of our more popular functions.

Which shortcuts will be added?
Num-Plus - Selection Increase - Increase your code selection in logical block rather than character by character.
Num-Minus - Selection Decrease - Reverse the effects of ‘Selection Increase’ by similar logical blocks.
Num-Period – Jump to Menu –  Our general purpose go-to navigation menu (Full details here)
Num-Enter – Jump to Symbol – Our Symbol-specific navigation menu (Full details here)
Num-Zero – Code / Refactor Menu – The ever popular CodeRush/Refactor key. Quick access to all the Refactorings and CodeProviders suited to your current context.

These shortcuts involve fewer keystrokes than their default equivalents. They are also typically easier to hit given their increased size and useful location.

Spell Checker

CRRSetupWizardSpellCheckerWhat is it?
As you might expect, CodeRush’s Spell Checker is the simple ability to check the spelling of certain specified parts of your document. It is disabled by default but can be enabled from the wizard in any of 3 ways.

What can be checked?
This screen lets you enable spell checking for 3 distinct parts of your code: Comments, Strings and API-level Members and Identifiers.
(For our purposes, API-Level members and identifiers are those that are public, protected or internal )

What if I need more?
These settings can be tweaked and fine-tuned on our options screen (Ctrl+Alt+Shift+O) within the ‘Editor\Spell Checker’ page.
From here you can specify more locations to check, filter others out and specify the dictionary you’d like to use.

Tab to Next Reference

CRRSetupWizardTabToNextReferenceWhat is it?
Tab to Next Reference is the ability to place your caret within an identifier (method, variable, method) and hit Tab to initiate navigation between all the references to that identifier. I find this one as least as useful as the built in Go To Definition (F12)

Any other associated shortcuts?
Yes. Shift+Tab will carry you back through your references in the reverse direction, and once you are finished navigating through the references, you can hit Esc (or Alt+End) to return directly to your start point via a hidden marker.

This has to be one of the the easiest way to navigate through your code.

Smart Semi-Colon

CRRSetupWizardSmartSemiColonWhat is it?
Intelligently repositions your caret when you hit the semi-colon key, so that the semi-colon is emitted in the most sensible location.

Why would I need that though?
Consider features like the auto-completion of braces and parenthesis. These features are great because they finish what you start, so that you don’t have to. They leave your caret where it is, enabling you to continue working on your inner code.
A few method calls later, and you are potentially buried in parenthesis. Smart semi-colon is a simple but effective feature which allows you to hit the semi-colon without digging yourself out from under the parenthesis mountain first.

CodeRush will determine where the semi-colon should go, and position your caret there first before emitting the character.

One Key Selection Embeddings

CRRSetupWizardOneKeySelectionEmbeddingWhat is it?
Selection Embeddings are best described as CodeRush Templates that envelop your selected code.
A One-Key Selection Embedding is one which is triggered by the pressing of a single key. You select your code and then hit a trigger key. Instead of replacing the selected code with the key, the code is wrapped in text according to which embedding was invoked.

CodeRush provides several out of the box.

C – Wrap code in Try..Catch
F – Wrap code in Try…Finally
T – Wrap code in Try…Catch…Finally
B
– Wrap code in a set of braces. { … }

 Code Template Expansion

CRRSetupWizardTemplateExpansionWhat are CodeRush Templates?
Often described as VS snippets on steroids, CodeRush Templates are short sequences of characters which generate more verbose text within the editor. Templates can be used to create methods, classes enumerations, block constructs, unit tests, test assertions and much more.

What can I configure?
On this page of the wizard, you’ll decide how Templates will be triggered.

Personally I like to pick the Space key for maximum speed and ease of activation (After all that space bar is nice and big and easy to hit). Others pick the Tab key in order to reduce the risk of accidental template expansion. You can also elect to disable the template system from this page.

 

Markers

CRRSetupWizardMarkersWhat are Markers?
Markers are your virtual breadcrumbs. They are like stack based transient bookmarks in your code.

Why would I need another kind of bookmark?
So your coding along. Everything is going well, when you realise that you need to check something. Drop a marker. (Alt+Home) to mark your place and go investigate whatever you feel like. When your done, hit a single key (Esc or Alt+End) and return not just to when you were previously, but to the exact frame of reference you had before.

Markers stack, which means you can drop as many as you like digging deeper and deeper into your code. When you’re ready, you collect them in reverse order (just like virtual breadcrumbs) leading you back to where you started.

CodeRush will drop additional markers when you navigate away from where you are. Go To Definition (F12), Go To Symbol (Ctrl+Shift+Q or Num+Enter) or Jump To (Ctrl+Alt+N) will all drop markers allowing you to navigate away to investigate something and then hit Esc to return once you’re done.

What can I configure?
On this page you can decide if you’re like to enable Markers and further which shortcut you’d like to use to collect them.

Note: Since VS2013, Visual Studio has altered it’s behaviour when navigating. Following jumping to an identifier’s declaration (F12), Visual studio selects the name at that declaration assuming that you want to do something with its name. This means that those have grown used to using Esc to collect markers have had to press Esc once to remove the selection and once more to collect the marker. You can opt to let CodeRush work around this behaviour by choosing the last option on this page of the wizard. 

We highly recommend choosing the final option for your marker configuration in order to make your navigation experience as smooth as possible.

IntelliRush

CRRSetupWizardIntelliRushWhat is it?
IntelliRush is the CodeRush version of IntelliSense.
It does every thing normal intellisense does, and more.

What extras do I get with IntelliRush?
You can Resize IntelliRush. Just grab the edge and expand your view.

You can filter content by member type: Restrict content to only Events, Properties or Extension methods (or something else) to quickly find the exact member you’re after.

You can filter content by hierarchy: Restrict content to a specific level of the hierarchy. Show only members declared on the class of the object being inspected, or choose another ancestor and show only members declared on that ancestor.

All filtering achievable using simple on-screen keystrokes whilst losing none of the power of intellisense.
 

Menu

CRRSetupWizardMenu

The preferences you set in the Setup wizard are not permanent. You can return to the Wizard and change any of your choices at any time. Just open the ‘CodeRush’ menu and choose the ‘Setup Wizard’ option to begin amending your choices.

The choices you make within the wizard have been chosen to get you up and running as quickly as possible. However there is a lot more customization available via our main Options screen also available from the ‘CodeRush’ menu or via the Ctrl+Shift+Alt+O shortcut.

 

 

 

Everyone is different and we all have our own preferences and approach. It is our hope that the minimal amount of configuration requested by our Setup Wizard, will greatly improve your CodeRush experience.

CodeRush for Roslyn is now available for as little as $50 a seat and a 30 day trial can be found in the Visual Studio Gallery.

CodeRush for Roslyn: The Fastest .Net Test Runner

Once again it's time to benchmark the CodeRush Test Runner with the competition.

So my last post on “CodeRush for Roslyn: Running Tests” sparked a few questions

Like ‘Is the CodeRush test runner really that fast?’ and ‘How do other test runners stack up against CodeRush for Roslyn?’

Test Conditions

To reproduce this benchmark scenario, you will need:

Software

  • 1 copy of Visual Studio 2015 – Update 3
  • 1 copy of the Nancy FX Solution, which includes 2,410 unit tests.
  • Latest versions of each test runner (I used the latest test runners available in August 2016).

Hardware

  • I used my laptop –> Intel® Core™ i5 M 520 with 8Gb RAM.

Test Procedure

  • Close any open instances of Visual Studio.
  • Start a fresh instance of Visual Studio with the test runner you want to benchmark already installed. Allow time to settle – see notes below.
  • Load the NancyFX solution. Allow time to settle – see notes below.
  • With the test runner you want to benchmark:
    • Run all tests. Note raw time as ‘Run 1’
    • Run all tests. Note raw time as ‘Run 2’
    • Run all tests. Note raw time as ‘Run 3’
    • Average the times from the three test runs. Enter the data in the table.
    • Make note of the number of tests detected by the test runner.
  • Close Visual Studio.
Repeat these steps for each test runner you want to evaluate.

Results

We've changed competing product names so we don't unduly upset anybody.

Here are the total times for each Test Runner on the Nancy FX Solution (lower is better):



Here's our test run data, in table format:

Notes:

  1. The "Test/Sec" column is calculated by taking the total number of tests (e.g., 2,410) divided by the test run time for each test runner. 
  2. The "CodeRush Is Faster By" shows how much faster CodeRush is than the competing tool. Values in this column are calculated by taking the CodeRush Test/Sec rate (e.g., 20.1) and dividing that by the Test/Sec rate for each competing product.
  3. The "JC" product tested failed to find 263 out of all 2,410 tests, so it's not doing as much work as the other test runners. Once this issue is fixed, the benchmark numbers for the "JC" product are likely to change.
  4. We realized the "RS" product we tested was incorrectly reporting total time to run all tests (erroneously reporting that it took much more time to run the tests than it actually did). So to be fair we used a stopwatch operated by a human to time the results for this product. Results manually timed like this might be off by as much as 1-2 seconds.
  5. Both the MS product and the JC product seem to have a "discovery" phase that runs every time before a test run actually gets started. During the discovery phase, test runner UI is blocked but the IDE remains responsive. We found this discovery phase for both products took two additional minutes to discover all the tests in the Nancy FX solution. We did not include those extra two minutes in calculating the total test run time for the MS and JC products, even though you could easily argue they are part of the test run. Note that the top three test runners (CodeRush, RS & TD) do not have a discovery phase, which means these three products are able to instantly start your test run.
In the category of number of Tests Run Per Second, CodeRush is the clear winner with an average of over 20 tests (in the Nancy FX solution) run per second:
The next closest competitor, RS, is only able to run 13.3 tests per second in the Nancy FX solution.

No competitor comes close to the speed and efficiency of the CodeRush test runner.

Summary

Not all runners are created equally. Some are better than others.

Features to look for in a good test runner:

  • Finds & runs 100% of your tests. At least one of the test runners we evaluated failed to find all the tests.
  • Finds your tests quickly. Two of the test runners we evaluated locked up test runner for an apparent "discovery phase" that lasted almost two minutes before the tests were actually run.
  • Collect test results as quickly as possible.

No matter how you slice those numbers, CodeRush for Roslyn is still the Fastest Test runner for .NET development.

Not convinced? Try it yourself. Download CodeRush for Roslyn and see just how much faster CodeRush is than your current test runner.

And one last thing…. Check out the price. CodeRush for Roslyn can be yours for only $49, and CodeRush is so much more than just a test runner.

CodeRush for Roslyn: Running Tests

CodeRush for Roslyn is RTM!

That’s right CodeRush for Roslyn is out of preview and available. With it we are shipping the best ever version of our test runner.

It’s the fastest, it’s the simplest, and it supports all the major testing frameworks (NUnit, XUnit, MSpec and VSUnit) out of the box.

Inline Tests

This test runner really is the simplest. With CodeRush you can run your tests direct from the editor.

  • Locate any Test

CRRTestingExampleTest

  • Place your caret within it.
  • Run your test with Ctrl+T, Ctrl+R. (Test –> Run)

When Run, this test passes and changes its icon to reflect its new state.

CRRTestingExampleTest

Naturally enough some tests do not pass. When a test fails, its Test Icon changes to indicate this, and the failing assertion is accentuated with a red background.

CRRTestRunnerFailingTest

More information can be found about the nature of the error if you hover the mouse over the Test Icon

CRRTestRunnerFailingTestWithHover

You can of course run multiple tests at once.

The keystrokes you use depend on the breadth of tests you wish to run.

For all tests in the Current File, use Ctrl+T, Ctrl+F. (Test –> File)
For all tests in the Current Class, use Ctrl+T, Ctrl+C. (Test –> Class)
For all tests in the Current Project, use Ctrl+T, Ctrl+P. (Test –> Project)
For all tests in the Solution, use Ctrl+T, Ctrl+S. (Test –> Solution)

Debugging a Test

Sometimes running a test is not enough. In some cases it can be very useful to debug directly into a test.

In this case you should:

  • Locate the Test
  • Place your caret within it
  • Press  Ctrl+T, Ctrl+D. (Test –> Debug)

When invoked this way, the Test will be run with the debugger attached. You’ll be able to stop on break points and use watch windows in all the usual ways. This allows you to setup a test for a particular situation and then observe exactly how your code behaves in that scenario. Literally your code under lab conditions.

Alternatively you can click the Test Icon to reveal the test context menu.

CRRTestingInlineMenu

Naturally you can Run test and Debug test from this menu. You can also locate the Go to runner to locate the current test within the Test Runner (see the next section for details on the Test Runner) or Run Test with Coverage.

A full description of Code Coverage is a topic for another post, but the short version is that CodeRush will track which lines of your code are executed when a test is run. This can give you a quick estimate of which parts of your code might require additional testing.

The last item is Add to Session. I’ll leave that one for a minute or two whilst we discuss the Test Runner.

Test Runner

This is the CodeRush TestRunner. Shown here with some of the Unit Tests within NancyFX

CRRTestRunnerNancyTests

You can launch the Test Runner in 3 ways.

  • From the Context menu of a test or test fixture. (Go to runner)
  • From the Main CodeRush menu (CodeRush | Test | Test Runner)
  • Using the universal Test Runner Shortcut (Ctrl + T, Ctrl+T)

The default view of the Test Runner will show you all the projects containing tests and the counts of tests within those projects.

All the standard options are available from within the Test Runner. From left to right we have ‘Run Selected Tests’, ‘Run All Tests’, ‘Debug Selected Tests’. Naturally enough we follow that with the ability to ‘Run Selected Tests with Coverage’ and ‘Run All Tests with Coverage

When you run your tests, the number in the brackets of each node expands to show not just the total, but the number of passing and failing tests within that node.

CRRTestRunnerNancyTestsRun

If you turn on the ‘Show Duration’ option CRRTestRunnerToolbarShowDuration you can also see how long any given node (single test or group) took to execute.

CRRTestRunnerNancyTestsRunDuration

At all times the status bar will track the number of the total number of tests, how many of them are currently Pass or Fail and how many are currently designated Ignored or Explicit.

CRRTestRunnerStatusBarNancyFX

Grouping and Filtering

Your tests can be grouped by Project, Namespace, Category, File Path or just as a Flat List.

CRRTestRunnerGroupingDropdown

You can show any combination of Not Run, Passed, Failed, Ignored or Explicit tests using the toolbar toggles.

CRRTestRunnerFilterToggles

Having determined the selection of tests you’re interested in, you can run any of those remaining visible through the use of the right click menu or the previously mentioned icons on the toolbar. This context menu is as for an individual test in the editor, but will now apply to all nodes within the one you right-click. This allows you run all tests in a namespace, project or category at the click of a button.

If you’re looking for a particular test, but aren’t sure where it is, than the test search box is your friend. As you might expect, enter some search text, hit enter and CodeRush will find any test that matches all your criteria (Filter Toggles, and Search)

CRRTestRunnerToolbarSearch

 

How Fast is the CodeRush Test Runner?

So the single simplest test is to instruct CodeRush to run all the tests in the Solution. Since I had the NancyFX solution loaded, I simply hit Ctrl+T, Ctrl+S and CodeRush located and ran the 2410 tests present.

Obviously I needed something to compare this with, so I also took a well known Brand ‘X’ test runner for a spin and these are the results I got.

Test Runner Test Execution Time
Brand ‘X’ 182s
CodeRush (Default settings) 143s
CodeRush (All Cores) 128s

So just using the default settings, CodeRush’s test runner is 39 seconds (22.5%) faster than the Brand ‘X’ test runner.

But you’ll notice that there is another entry for CodeRush. When CodeRush is allowed to use all my processor’s cores, it gets even quicker, eventually toping out (on my machine) at a little over 54 seconds (30%) faster than the Brand ‘X’ test runner.

Sessions

So you’ll recall a few sections back I hinted at a new CodeRush test runner feature.

The CodeRush test runner, like all other test runners has long supported the idea of running either a single test or a set of tests defined by a class, file, project or indeed the entire solution.

However you don’t always, especially in legacy projects, have the convenience of having all appropriate tests in a single namespace or project where you need them. This wouldn’t necessarily be an issue if there weren’t those strange group of tests written in a dark corner which take an excessively long time to run. Then there’s that other set that you’ve been told not to run because no-one is quite sure that they don’t have side effects.

Then there are the tests that you really do want to run. They should all exist in the same place, but for some unearthly reason they have been defined in a number of strange disparate locations in several different projects. You will of course bring these tests together in some carefully crafted namespaces in just one or 2 projects in good time, but right now is not the time. They work well. they are essential to the stability of the project. But they are disparate and a pain to use.

Enter ‘CodeRush Testing Sessions’

A CodeRush Testing Session is a very simple thing. (Well all the best things are aren’t they.) A Session is a named ad-hoc selection of tests. Nothing more. No need to alter code to add categories. Just pick the tests you care about, and start to work with them. Of course the real key with sessions is in how you use them.

To create a new session…

Just visit the context menu of any test (or group of tests) and choose Add to Session | Create New Session. Your chosen tests are added to a new session with the name “Session 1” or similar. The Test runner has a new Tab named for the Session you’ve created, containing only those tests that you added. Feel free to add more tests to the Session. As many (or as few) as you want.

To name a session

Simply double-click the name of the session, and you’ll be able to name it whatever you like. I like to use ‘WIP’ (Work in Progress) to house those tests that are useful to me in my current situation.

To add more tests to a session

Pick Add to Session | Add to WIP Session from the Test (or Test Fixture) context menu, either from an appropriate node in the Test Runner, or from within the editor itself.

To use a session…

Simply use the same standard buttons as you do when there are no active session. ‘Run All Tests’ and ‘Run All Tests with Coverage’ now run within the confines of your active Session. Naturally because the Test Runner hides tests (and fixtures) which aren’t in your current session, it’s far simpler to find the results you’re after.

To switch between sessions…

It shouldn’t really come as much of a surprise, that you can have multiple sessions on the go at the same time. Each time you create one, a new tab is added to represent the tests you added to it.

You can have Sessions for:

  • Those tests you need to run every few minutes, to check you’re not breaking some part of the subsystem you’re working on.
  • All the tests in your solution except those few slow tests you try to avoid running unless absolutely necessary.
  • Those slow tests you’ve been avoiding, but which need to run every now and again, because slow or not, you do need them.

There are no rules. You could pick 3 tests from one project, all the tests from a 2nd project and 6 tests from 6 different test fixtures in a 3rd project.

This is a great feature for use when you know you have a need to run 2 or 3 tests (or sets of tests) which are related by something other than the standard mechanisms. I personally like to create 3 sessions ‘WIP’ (Work in Progress), ‘All but Slow’ and ‘Slow Tests’, but feel free to use sessions for anything you like.

So how do you switch between session? Simple: Just select the tab which represents the session when you want to work with.

Oh and one last thing: CodeRush Test Sessions will persist between VS sessions. Which means they will survive the closing and re-opening of both your solution and studio, allowing you to setup exactly the sessions you need, safe in the knowledge that you won’t have to rebuild them in your next coding session.

Testing is fast, fun and easy again. So go out there and build some rock solid and fully tested code.

CodeRush for Roslyn – Free to try. Only $49 to buy! (Includes a year of free updates)

CodeRush for Roslyn: The Navigation Menu

Every symbol in your code has significance. Every symbol is a jumping off point for all sorts of investigation.

Typically you’ll be used to being able to see “All References” to a variable or class, and determine exactly how heavily used it is within your code.

This is a great way to get a general feel for where your code is used within your project\solution, but what happens if you need to ask some more specific questions? What if you wanted to find something more focused than “every reference” to your chosen symbol?

Enter the Navigation Menu

The Navigation menu (AKA the JumpTo menu) is your one stop shop for all sorts of navigation goodies.

Place your caret on any symbol in your code and hit Ctrl+Alt+N (or Num Decimal if you’ve enabled numeric keypad bindings)

NavigateFromClassReference

I’ve chosen to place my caret on an instantiation of a StringBuilder in the source of OpenLiveWriter. As a result I’m being offered the choice of locating related Base Types, Declaration, Derived Types, Instantiations, Parent Types and more.

All I have to do to choose one of these options, is highlight one (using Arrow keys) and select it (using Enter).

Once selected, the Navigation menu will delegate to the appropriate NavigationProvider, which will then list all of the qualifying code elements.

In my case I’ve chosen ‘Instantiations’ because I’m interested in finding a particular piece of code I was looking at earlier which I know created a StringBuilder.

When I pick ‘Instantiations’ from the list I get the following window:

InstantiationsOfStringBuilder

It looks like OpenLiveWriter uses quite a few StringBuilders within it’s code. However I remember that the code I was looking at, created it’s StringBuilder using the length of a buffer as a parameter.

So I type ‘buffer’ into the search window at the top of the list, and CodeRush narrows it’s list down from over 100 items, to only 6.

InstantiationsOfStringBuilderFilteredByBuffer

From here it was very easy to locate the code I was looking for. Once I found the correct entry, I simply hit [Enter]  and CodeRush positioned me right where I wanted to be.

Navigation Providers

As you can see from our worked example, the Navigation menu can be very useful. However I’ve only scratched the surface. I worked through an example with the instantiations entry which, as you saw, provides a list of places where your chosen symbol is instantiated.

However if you recall the Navigation menu offered me 7 other choices to help us navigate to the code of our choice.

The last 2 of these are fixed items. Symbols and Files will take us to the Quick Nav and Quick File Nav features respectively.

The others are Navigation Providers each dedicated to locating a specific type of related code.

At the time of writing there are 11 NavigationProviders and counting. Each dedicated to a specific type of code relationship. The reason we only saw 6 of them in the previous example is that they are context sensitive. They only appear when appropriate.

They are:

  • Declaration
  • Base Types
  • Derived Types
  • Parent Type
  • Members
  • Overridden Members
  • Instantiations
  • Implementations
  • Assignments
  • Overloads
  • Overrides

While all of these providers are useful, I feel it’s worth drawing attention to a few of them in particular.

Firstly the Assignments provider. How often have you wondered about all the places in your code where a field is altered? The Assignments navigation provider will let you locate all the statements that assign a value to your chosen symbol.

The Base Types provider will provide you with a list, not just of immediate base types, but of the entire ancestral hierarchy of your nominated type, including interfaces.

The Implementations provider is particularly useful.
You can use this one on references to interfaces or abstract classes
Place your caret on the reference to the interface and ask to see all implementations. Immediately you’ll be presented with a list of classes which implement the interface in question.

Ordinarily you might think to use the “All References” functionality to locate these classes. However the All References feature does exactly what it says. It returns ALL references and sometimes this can be a bit excessive. For example: Users of VB.net will be used to asking for All References to a given interface, and then having to deal with more results than they might want to. This is because the default interface implementation technique is explicit. As such the name of the interface is mentioned (and thus creates a ‘reference’) for each and every member in that interface. Implementations makes this a non-issue.

You can also use it on references to interfaces or abstract members
Imagine you have a variable of type IFoo and are calling it’s Bar method. If you place your caret on the call to Bar and invoke the Implementations Navigation provider, you’ll be provided with a list of every class that implements IFoo and more specifically, the methods that implement IFoo.Bar. You’ll then be able to navigate directly to any one of them.

Options

Naturally each Navigation Provider has it’s own custom set of options. These are typically used to filter the available list of items: Source Code vs Meta, Open Files vs All Files

Just tap Ctrl to reveal the options for any given Navigation provider

The Navigation Menu is so full of functionality that it’s starting to become the first place I go for almost any form of navigation. I highly recommend you check it out, whatever you’re looking for.

Can you think of an additional Navigation Provider you’d like to see? Let us know in the comments and we’ll see what we can do to help.

Oh and one more thing

The NavigationProvider user interface leaves things simple in the interests of speed. If at any point you’d like to examine the hierarchy of your result set, you can transfer it to the References interface in a new tab by pressing Ctrl+P or clicking the icon in the upper right of the NavigationProvider. Since the References tool window can host multiple tabs, you can maintain several lists of interest at the same time.

So if you’ve not already got your copy of CodeRush for Roslyn, head on over to the visual studio gallery and grab a copy of our preview now

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

More Posts