I'm trying to get the character on the left of cursor. I've got the handler that intercepts the LineChanged
event.
OnLineChanged(TextPoint startPoint, TextPoint endPoint, int Hint)
I couldn't find any built in method to get that from TextPoint
s.
What's the best way to do that?
Also, is there a way to check if the active window has IntelliSense window open? I want to abort the event handler execution if IntelliSense is open.
To get the character to the left of the EnvDTE.TextPoint:
string CharacterToTheLeft(EnvDTE.TextPoint p)
{
EnvDTE.EditPoint editPoint = p.CreateEditPoint();
editPoint.CharLeft();
return editPoint.GetText(1);
}
To create an edit point at the current cursor position from EnvDTE.TextPoint startPoint:
EnvDTE.TextSelection ts = startPoint.Parent.Selection;
EnvDTE.EditPoint editPoint = ts.ActivePoint.CreateEditPoint();