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 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.
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.
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);
发布评论
评论(2)
我没有代码示例,但找到了 ViewFilter.HandleQuickInfo 方法听起来像是您需要执行的步骤。
来源: ViewFilter.HandleQuickInfo
编辑:
您可以检索当前的IVsTextView 使用 IVsTextManager。
但是,我被困在那里,无法使用 IVsTextView.UpdateTipWindow,它永远不会在我传递的虚拟对象上调用任何内容,所以我认为它需要来自语言服务的已经可见的 IVsTipWindow。
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.
Source: ViewFilter.HandleQuickInfo
Edit:
You can retrieve the current IVsTextView using IVsTextManager.
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.
快速视图显示了类中存在且可访问的方法和属性,因此一种解决方案是使用反射来获取此信息。
//获取MyClass类的方法
MethodInfo[] methodInfos = typeof(MyClass).GetMethods(BindingFlags.Public |
BindingFlags.Static);
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);