5

I searched without succes a method to get from my C# addin visual studio extension what displayed in the Quick Info when the mouse is moved over some code element.

I hope that there's an elegant way to do it.

Thanks.

rodi
  • 51
  • 3

2 Answers2

0

I do not have a code example, but found the following documentation for the ViewFilter.HandleQuickInfo method which sounds like the steps you need to do.

The base method calls the GetCaretPos method on the IVsTextView object passed to the ViewFilter constructor to obtain the current caret position. This position is then passed to the OnSyncQuickInfo(IVsTextView, Int32, Int32) method on the Source object (obtained from the CodeWindowManager object in the ViewFilter constructor). If OnSyncQuickInfo(IVsTextView, Int32, Int32) returns any text, this method next calls the GetFullDataTipText method to get any additional information from the debugger if debugging is active. Finally, a new (or current) TextTipData object is used to display the tool tip.

Source: ViewFilter.HandleQuickInfo

Edit:

You can retrieve the current IVsTextView using IVsTextManager.

var textManager = Resolve.Service<IVsTextManager, SVsTextManager>();

IVsTextView textView;
ErrorHandler.ThrowOnFailure(textManager.GetActiveView(fMustHaveFocus: 1, pBuffer: null, ppView: out textView));

Int32 caretRow, caretCol;
ErrorHandler.ThrowOnFailure(textView.GetCaretPos(out caretRow, out caretCol));

However, I am stuck there, and unable to do anything useful with IVsTextView.UpdateTipWindow, it never calls anything on my passed dummy object, so I presume it requires an already visible IVsTipWindow from a language service.

sisve
  • 19,501
  • 3
  • 53
  • 95
  • Thanks for your answer , but unfortunatly I already tested this solution without success. – rodi Feb 01 '11 at 20:09
-1

The Quickview shows the methods and properties that exists and are accessible on the class so one solution would be to use reflection to get this information.

//Gets the methods of the Class MyClass MethodInfo[] methodInfos = typeof(MyClass).GetMethods(BindingFlags.Public | BindingFlags.Static);

Tor Andersson
  • 109
  • 1
  • 6
  • 1
    Thanks but what i want is not to list all methods of a class, but get the info of the quickview,and when i move the mouse over a code element i didnt know in which class this code element exist to use your solution. – rodi Feb 01 '11 at 02:59