In C# or Vb.Net, using the Visual Studio 2013 SDK, how I could add an additional element on Intellisense when the info of a member is shown?.
My intention is not to add a completion/suggestion element, I would like to add custom additional info below the info that is shown for a member that can throw an exception like a method, function or property (getter/setter), not a keyword.
I read a little bit the members of Microsoft.VisualStudio.Language.Intellisense namespace but I didn't take any clear idea about it.
My goal, with the help I could get here, is to find the answer to develop a simple extension that will add (documented)Exception information for members, something like this:
I wonder to bring back this useful feature in Visual Studio for C#, and add it also for VB.Net, then if successful I'll share it for free with all yours like I did in the past with this useful extension:
Just I comment that because any help could be rewarded for all of us in that way!.
Additionally to my question, and only Additionally, if someone could start guiding me about how to figure out the way to retrieve the Xml documentation of the members ( <exception cref="Exception name">
) to do this, or maybe a simple way, I would be very grateful.
EDIT:
About the Xml documentation, I get the idea to use the Visual Studio object browser to inspect the exceptions of the member that will be listed by Intellisense instead of messing with Reflection? to get exception info. That could be a better and viable way to do it once I can figure out how to automate the object browser from SDK, but I'm just commenting this, maybe that will be a new question once this question could be solved, because firstly I need to solve this step, I hope so.
You can trigger IntelliSense in any editor window by typing Ctrl+Space or by typing a trigger character (such as the dot character (.)
The two main types of extensions are VSPackages and MEF extensions. In general, VSPackage extensions are used for extensions that use or extend commands, tool windows, and projects. MEF extensions are used to extend or customize the Visual Studio editor.
Go to Tools | Options | Text Editor | C/C++. This dialog displays a window that allows you to toggle Automatic brace completion. Automatic brace completion is the feature where, when you type { , a corresponding } is automatically typed for you.
There are few types of IntelliSence
extensibility points that you need to use for each of the following cases:
The tool-tip shown when hovering text element is called QuickInfo
tool-tip, and can be implemented by yourself via inheriting from IQuickInfoSource
interface and creating a matching IIntellisenseController
. A full walk-through can be found on MSDN:
Example:
Make sure to make your IQuickInfoSourceProvider
load your IQuickInfoSource
before the default Visual-Studio
one by using the Order
attribute - otherwise the default QuickInfo
is not going to be shown:
[Order(Before = "Default Quick Info Presenter")]
The tool-tip shown when writing method name which shows it's signature is called Signature Help
and can be implemented by inheriting ISignatureHelpSource
in a very similar way to the QuickInfo
tool-tip. A full walkthrough can be found on MSDN:
Example:
Code Snippets
- which are irrelevant for you.
Statement Completions
- which are irrelevant for you.
Note that you will need to make an IClassifier
in your project for the tool-tips to be displayed, with this you can also modify the view so that the Exceptions
will be viewed differently as you wish. Guide on MSDN.
Getting the information on the methods on the other hand is up to you. you can use an external manual source and use it in your IQuickInfoSource
or read it from a matching XML Comment
document by analysing the ITextStructureNavigator
's read word using Roslyn
over the code document that you are navigating.
Sorry if it was a little abstract answer but this is a very broad question and there are many ways to implement such an extension.
P.S.: I've managed to make a similar extension in low quality in order to study this field so if you have any following questions about the implementation itself feel free to ask.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With