public int ReplaceStream(int iPos, int iOldLen, IntPtr pszText, int iNewLen) {
if (pszText != IntPtr.Zero) {
var str = Marshal.PtrToStringBSTR(pszText);
TextBuffer.Replace(new Span(iPos, iOldLen), str);
} else {
TextBuffer.Delete(new Span(iPos, iOldLen));
}
return VSConstants.S_OK;
}