Share via


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)

Syntax

'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

Parameters

  • pSnippet
    Type: IXMLDOMNode

    [in] Contains the code snippet text.

  • 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).

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

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 method) to make sure the snippet can actually be inserted at the specified location.

.NET Framework Security

See Also

Reference

IVsExpansion Interface

Microsoft.VisualStudio.TextManager.Interop Namespace