VS2010 Debugging: Display Datatip w/o mouseover (use keyboard)?

1.1k Views Asked by At

I'm in VS2010, on a breakpoint. How can I cause a datatip to be displayed for a given variable/expression w/o using my mouse to hover it?

5

There are 5 best solutions below

0
On BEST ANSWER

That can't be done, exactly, but you can get the same result by selecting the variable you want to watch (using ReSharper's Ctrl + Alt + / can speed this up), and pressing Shift + F9, which will raise "QuickWatch" modal window with the datatip contained within.

If you prefer, you can also go into Options->Keyboard and bind the Debug.AddWatch to a different keyboard shortcut, and use that instead of Shift + F9, and then your variable data will persist in the Watch window so you can come back to it later (as suggested here)

You can also do this by opening the command window (Ctrl + Alt + A) and typing Debug.AddWatch variable_name.

0
On

While you can pin multiple windows in VS it will be a somewhat cumbersome experience and you will have to over it.

I personally use visual studio plugin called Oz Code, that automatically annotates all the local variables and intermediate results so I don't have to chose which variables to pinpoint.

The results looks something like this:

enter image description here

0
On

The Locals and Autos windows might be helpful as they show all local variables, (they even show the return value of called functions!).

Note however that they show directly only variables in scope, so if you need a detail property that it is not yet menotioned in the code you can drilldown using the / keys, however if it is already mentioned in the code in the current scope then you should be able to see it directly in the Autos window.

0
On

Will adding a watch not be suitable? When you hit your breakpoint the relevant details of the variable will be shown in the watch window.

Perhaps I have misunderstood what you're trying to achieve here!

0
On

You can click the 'pin' icon to force any datatip to stay open, and it will update to the current contents when you hit the breakpoint.

I don't know of a way to open a specified tip without pinning it, however.