IVsExpansion.InsertSpecificExpansion Method
Inserts the code snippet from the specified XML node into the text buffer at the specified position.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)
'Declaration
Function InsertSpecificExpansion ( _
pSnippet As IXMLDOMNode, _
tsInsertPos As TextSpan, _
pExpansionClient As IVsExpansionClient, _
guidLang As Guid, _
pszRelativePath As String, _
<OutAttribute> ByRef pSession As IVsExpansionSession _
) As Integer
int InsertSpecificExpansion(
IXMLDOMNode pSnippet,
TextSpan tsInsertPos,
IVsExpansionClient pExpansionClient,
Guid guidLang,
string pszRelativePath,
out IVsExpansionSession pSession
)
int InsertSpecificExpansion(
[InAttribute] IXMLDOMNode^ pSnippet,
[InAttribute] TextSpan tsInsertPos,
[InAttribute] IVsExpansionClient^ pExpansionClient,
[InAttribute] Guid guidLang,
[InAttribute] String^ pszRelativePath,
[OutAttribute] IVsExpansionSession^% pSession
)
abstract InsertSpecificExpansion :
pSnippet:IXMLDOMNode *
tsInsertPos:TextSpan *
pExpansionClient:IVsExpansionClient *
guidLang:Guid *
pszRelativePath:string *
pSession:IVsExpansionSession byref -> int
function InsertSpecificExpansion(
pSnippet : IXMLDOMNode,
tsInsertPos : TextSpan,
pExpansionClient : IVsExpansionClient,
guidLang : Guid,
pszRelativePath : String,
pSession : IVsExpansionSession
) : int
- pSnippet
Type: IXMLDOMNode
[in] Contains the code snippet text.
- tsInsertPos
Type: Microsoft.VisualStudio.TextManager.Interop.TextSpan
[in] The location in the text buffer to insert the code snippet.
- pExpansionClient
Type: Microsoft.VisualStudio.TextManager.Interop.IVsExpansionClient
[in] Receives notifications about the insertion process. This can be nulla null reference (Nothing in Visual Basic).
- guidLang
Type: System.Guid
[in] The GUID of the language service. Can be nulla null reference (Nothing in Visual Basic). The default is the language service of the file.
- pszRelativePath
Type: System.String
[in] A path that is used if the node references an external file. This is typically nulla null reference (Nothing in Visual Basic).
- pSession
Type: Microsoft.VisualStudio.TextManager.Interop.IVsExpansionSession%
[out] The session that is used while the snippet is being edited in place.
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
From textmgr2.idl:
HRESULT IVsExpansion::InsertSpecificExpansion(
[in]IXMLDOMNode *pSnippet,
[in] TextSpan tsInsertPos,
[in]IVsExpansionClient *pExpansionClient,
[in]GUID guidLang,
[in] BSTR pszRelativePath,
[out] IVsExpansionSession **pSession
);
This method is used only if you are working directly with code snippet files and is rarely used.
If an IVsExpansionClient object is supplied, it receives before (OnBeforeInsertion method) and after (OnAfterInsertion method) notifications during the insertion process. The expansion client is also used to validate the kind of snippet (IsValidKind(IVsTextLines, array<TextSpan[], String) method) to make sure the snippet can actually be inserted at the specified location.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.