Hiya,
I'm trying delete a class body in using the new Text Editor code model in a Visual Studio 2010 extension. That is, I'm trying to use the Delete method on ITextEdit to delete everything between curly brackets.
I can get access to the Absolute Character Position of the start and end of the class using the
codeClass.GetStartPoint(vsCMPart.vsCMPartBody).CreateEditPoint().AbsoluteCharOffset
and
codeClass.GetEndPoint(vsCMPart.vsCMPartBody).CreateEditPoint().AbsoluteCharOffset
methods on the CodeClass interface. If I then get an ITextEdit from the current IWpfTextViewHost's ITextBuffer, and then try to delete:
iTextEdit.Delete(startCharOffset, endCharOffset - startCharOffset);
the deletion is incorrect. It appears there isn't a 1:1 mapping between AbsoluteCharOffset on the old model and position in the new text model.
How do I interact between the two models?
Thanks in advance for your help.