Compartilhar via


ExpansionProvider.OnBeforeInsertion Method

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

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)

Syntax

'Declaração
Public Overridable Function OnBeforeInsertion ( _
    session As IVsExpansionSession _
) As Integer
public virtual int OnBeforeInsertion(
    IVsExpansionSession session
)

Parameters

Return Value

Type: System.Int32
If successful, returns S_OK; otherwise, returns an error code.

Implements

IVsExpansionClient.OnBeforeInsertion(IVsExpansionSession)

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 nulla null reference (Nothing in Visual Basic) in which case the base method returns E_UNEXPECTED (a valid session object must be given to this method).

.NET Framework Security

See Also

Reference

ExpansionProvider Class

Microsoft.VisualStudio.Package Namespace