I'm writing a (very) simple Visual Studio addin. Two things that would make it work nicer are:
A context menu.
Knowing the caret position in the current document (so I can inject text at that position).
Any ideas?
To add a context menu to your addin, you create a CommandBarPopup from:
_applicationObject.CommandBars["Code Window"]
You can view a sample here.
The second part of your question is a little simpler, the current "selection" (or insertion point) is handled by:
(TextSelection)_applicationObject.ActiveDocument.Selection
"_applicationObject" is an instance the DTE Application object created by the add-in project wizard.
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