I want to insert a code snippet from a code snippet library in Visual Studio into a string instead of a code editor window using C#. Into a code editor window a snippet is inserted like this:
IVsTextLines textLines; m_vsTextView.GetBuffer(out textLines); IVsExpansion bufferExpansion = (IVsExpansion)textLines; bufferExpansion.InsertNamedExpansion(...);
The problem is that I can't find out how to get an IVsExpansion (or IVsTextLines) compatible text buffer from a anything but a text editor window. The code like this:
string s = ""; IVsExpansion bufferExpansion = (IVsExpansion)s;
doesn't work because string is not convertible to IVsExpansion. Can someone advise how to create a text buffer with which the IVsExpansion interface can be connected?