In a post last week I mentioned a shortcoming of CodeRush navigation capabilities. On Friday (we don't work Fridays here) I decided that instead of sitting on my hands and complain I'll try to do something about it. I'll write a plugin for CodeRush that does this. I've written a few CodeRush plugins before, but I have never found the time to make something that I feel I can share with others. Not that the current implementation is a master piece, but it is small simple and works for what I want it to.
Because in my opinion it is such a pain to navigate the CodeRush object model I'll document here what I did and maybe the following will happen:
- Someone will comment on the code suggesting a better way of achieving the same result.
- Someone will use the code to implement his/her own plugin.
So here we go.
The first step is to define what we want to achieve. Take the following code.
public class CarTester
public CarTester(ICar car)
_car = car;
public void TestCar()
Let's imagine that there are many implementations of ICar such as Sedan, Trailer etc.
You are interested in working on the Truck Implementation. While getting familiar with the code you end up in the TestCar() method in CarTester. At this point you want to jump to the Truck implementation of ICar. So what do you do in Visual Studio to get to the Truck implementation? F12? It will only take you to the interface. You're out of luck. The goal of the plugin is to: "Position the caret on a method that's called on an Interface such as _car.Drive() and navigate to an implementation of your choice".
In the screenshot below you can see that the menu shows a list of all classes that implements the Interface ICar.
In the next part we will start to walk through the code of the plugin.