CodeRush Plugin – Navigate to Implementation Part 1

19 באוקטובר 2008

2 תגובות

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


{


    ICar _car;


    public CarTester(ICar car)


    {


        _car = car;


    }


 


    public void TestCar()


    {


        _car.Drive();


        _car.PushBreaks(2);


    }


}


 


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.


 


 


jump feature menu


 


 


In the next part we will start to walk through the code of the plugin.


 

kick it on DotNetKicks.com

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. (*) שדות חובה מסומנים

2 תגובות

  1. ivonne25 באוגוסט 2011 ב 12:47

    Que frase necesaria… La idea fenomenal, excelente
    http://rsfiles.servehttp.com/

    shabab

    להגיב
  2. Kenneth28 במרץ 2012 ב 2:37

    So-so. Something was not impressed.

    להגיב