Export (0) Print
Expand All

ExpansionProvider.OnBeforeInsertion Method

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

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.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.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)

public virtual int OnBeforeInsertion(
	IVsExpansionSession session
)

Parameters

session
Type: Microsoft.VisualStudio.TextManager.Interop.IVsExpansionSession

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

Return Value

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

Implements

IVsExpansionClient.OnBeforeInsertion(IVsExpansionSession)

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

Show:
© 2014 Microsoft