IVsExpansion.InsertSpecificExpansion Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Inserts the code snippet from the specified XML node into the text buffer at the specified position.
public:
int InsertSpecificExpansion(MSXML::IXMLDOMNode ^ pSnippet, Microsoft::VisualStudio::TextManager::Interop::TextSpan tsInsertPos, Microsoft::VisualStudio::TextManager::Interop::IVsExpansionClient ^ pExpansionClient, Guid guidLang, System::String ^ pszRelativePath, [Runtime::InteropServices::Out] Microsoft::VisualStudio::TextManager::Interop::IVsExpansionSession ^ % pSession);
public int InsertSpecificExpansion (MSXML.IXMLDOMNode pSnippet, Microsoft.VisualStudio.TextManager.Interop.TextSpan tsInsertPos, Microsoft.VisualStudio.TextManager.Interop.IVsExpansionClient pExpansionClient, Guid guidLang, string pszRelativePath, out Microsoft.VisualStudio.TextManager.Interop.IVsExpansionSession pSession);
abstract member InsertSpecificExpansion : MSXML.IXMLDOMNode * Microsoft.VisualStudio.TextManager.Interop.TextSpan * Microsoft.VisualStudio.TextManager.Interop.IVsExpansionClient * Guid * string * IVsExpansionSession -> int
Public Function InsertSpecificExpansion (pSnippet As IXMLDOMNode, tsInsertPos As TextSpan, pExpansionClient As IVsExpansionClient, guidLang As Guid, pszRelativePath As String, ByRef pSession As IVsExpansionSession) As Integer
Parameters
- pSnippet
- IXMLDOMNode
[in] Contains the code snippet text.
- tsInsertPos
- TextSpan
[in] The location in the text buffer to insert the code snippet.
- pExpansionClient
- IVsExpansionClient
[in] Receives notifications about the insertion process. This can be null.
- guidLang
- Guid
[in] The GUID of the language service. Can be null. The default is the language service of the file.
- pszRelativePath
- String
[in] A path that is used if the node references an external file. This is typically null.
- pSession
- IVsExpansionSession
[out] The session that is used while the snippet is being edited in place.
Returns
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.