views:

140

answers:

2

Is there a free addin or resharper plugin that will let me see the actual value of a constant value when you hover over a reference to it ?

Since the compiler forces const fields or properties to be a concrete compile-time constant, it is only logical that it show it straight in the tooltip.

eg:

 
   const int DISPLAY_MODE_SIMPLE = 0x02;
   const int DISPLAY_MODE_ADVANCED = 0x04;

   void DoSomething(int displayMode) 
   {
      if (displayMode == DISPLAY_MODE_SIMPLE) {
         ShowSimpleDialog();
      }
   }

I want to hover over DISPLAY_MODE_SIMPLE and see in the tooltip: int MyType.DISPLAY_MODE_SIMPLE = 0x02

I am dealing with a lot of code lately that doesn't use Enums (Java converted with IKVMC), and constantly having to go back and forth when examining old code using it is very irritating.

Neither ReSharper 5 nor Visual Studio 2010 seem to have this feature.

Edit: I am not talking about the debugger. It works with that of course.

+2  A: 

When I hover over the DISPLAY_MODE_SIMPLE reference in DoSomething, I see "(constant) int MyType.DISPLAY_MODE_SIMPLE = 2" in the tooltip. This does not appear when I suspend R# 5, so there must be some R# setting that you're not using...

bdukes
I don't have that with R#5 in VS2008. Maybe there's a setting to turn it on?
Greg
@Greg I don't remember changing any settings (or installing any plugins) that I would expect to affect that...
bdukes
Was that in debug mode or edit mode?
Greg
it works in debug mode of course, I was asking about the regular code editor.
epsil0n
@Greg @epsil0n I'm seeing this in the regular code editor
bdukes
Weird. I've modified my settings, so maybe I turned it off accidentally.
Greg
+2  A: 

What about using "Code Definition Windows". View -> Code Definition WIndow in Visual Studio?

aloneguid
Doesn't help when the constant is in a 3rd party library.
epsil0n
Just tried. Works for .NET system libraries as well as 3rdparty libraries.I have ReSharper installed. Maybe that's the reason.I'm also trying that in VS 2010. Just tried in VS 2008, it works.
aloneguid