Compartir a través de


ExpansionProvider.OnBeforeInsertion(IVsExpansionSession) Method

Definition

Called just before the snippet has been inserted into the source.

public:
 virtual int OnBeforeInsertion(Microsoft::VisualStudio::TextManager::Interop::IVsExpansionSession ^ session);
public:
 virtual int OnBeforeInsertion(Microsoft::VisualStudio::TextManager::Interop::IVsExpansionSession ^ session);
 virtual int OnBeforeInsertion(Microsoft::VisualStudio::TextManager::Interop::IVsExpansionSession const & session);
public virtual int OnBeforeInsertion (Microsoft.VisualStudio.TextManager.Interop.IVsExpansionSession session);
abstract member OnBeforeInsertion : Microsoft.VisualStudio.TextManager.Interop.IVsExpansionSession -> int
override this.OnBeforeInsertion : Microsoft.VisualStudio.TextManager.Interop.IVsExpansionSession -> int
Public Overridable Function OnBeforeInsertion (session As IVsExpansionSession) As Integer

Parameters

session
IVsExpansionSession

[in] An IVsExpansionSession object representing the expansion session that is currently active.

Returns

If successful, returns S_OK; otherwise, returns an error code.

Implements

Remarks

This method provides an opportunity to set up default values for fields based on the snippet template to be inserted. If this method returns an error code, the snippet insertion is stopped.

This method is an implementation of the OnBeforeInsertion method on the IVsExpansionClient interface.

The base method sets the internal flag indicating an expansion session is active, caches the given IVsExpansionSession object, and then calls the SetFieldDefault method on the IVsExpansionSession object for each default field value in the internal default field values list. The base method always returns S_OK unless the session object is null in which case the base method returns E_UNEXPECTED (a valid session object must be given to this method).

Applies to