ExpansionProvider.OnBeforeInsertion Method
Called just before the snippet has been inserted into the source.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Syntax
'Declaration
Public Overridable Function OnBeforeInsertion ( _
session As IVsExpansionSession _
) As Integer
public virtual int OnBeforeInsertion(
IVsExpansionSession session
)
public:
virtual int OnBeforeInsertion(
IVsExpansionSession^ session
)
abstract OnBeforeInsertion :
session:IVsExpansionSession -> int
override OnBeforeInsertion :
session:IVsExpansionSession -> int
public function OnBeforeInsertion(
session : IVsExpansionSession
) : int
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)
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.