I'd like to get notified whenever the caret position changed in the active text view. The only thing EnvDTE seems to offer is the LineChanged event, which of-course does not get raised when moving the caret left or right within the same line.
I realize VS2010's Editor Extensibility lets you do this with no sweat, but I need a solution that is backwards compatible with VS2008.
Have you seen this: DTE2 events don't fire
You have to keep a local instance of the Events object, otherwise the event wont fire (I assume because the COM backed Events object went out of scope and was GC'd):
public class MyVSPackage
{
TextEditorEvents _textEditorEvents;
public MyVSPackage()
{
_textEditorEvents = DTE.Events.TextEditorEvents;
_textEditorEvents.LineChanged += (point, endPoint, hint) => //Do something here
}
}
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