共用方式為


IVsExpansionFunction Interface

Represents an expansion function in a code snippet.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop.8.0 (in Microsoft.VisualStudio.TextManager.Interop.8.0.dll)

Syntax

'宣告
<InterfaceTypeAttribute()> _
<GuidAttribute("563011A2-1611-48ED-B3B1-189060064F66")> _
Public Interface IVsExpansionFunction
[InterfaceTypeAttribute()]
[GuidAttribute("563011A2-1611-48ED-B3B1-189060064F66")]
public interface IVsExpansionFunction
[InterfaceTypeAttribute()]
[GuidAttribute(L"563011A2-1611-48ED-B3B1-189060064F66")]
public interface class IVsExpansionFunction
[<InterfaceTypeAttribute()>]
[<GuidAttribute("563011A2-1611-48ED-B3B1-189060064F66")>]
type IVsExpansionFunction =  interface end
public interface IVsExpansionFunction

The IVsExpansionFunction type exposes the following members.

Methods

  Name Description
Public method FieldChanged Called when another field in the inserted code snippet is changed.
Public method GetCurrentValue Returns the current value of the expansion function.
Public method GetDefaultValue Returns the default string to be inserted before any template is edited.
Public method GetFunctionType Returns the type of this expansion function (value or list of values).
Public method GetListCount Returns the number of items in the list of values associated with the expansion function.
Public method GetListText Returns the specified value from a list of values associated with the expansion function.
Public method ReleaseFunction Called when the expansion function is no longer needed.

Top

Remarks

An expansion function in a code snippet is a function name associated with a particular field that represents a single value or a list of values (which is presented in an IntelliSense completion list). See Function Element (IntelliSense Code Snippets) for details on how expansion functions are declared in a code snippet file.

The function name obtaisn an expansion function object as represented by the IVsExpansionFunction interface from a language service. That IVsExpansionFunction object is then asked for the value or values to be presented in the field when the code snippet is inserted. This gives for dynamically generated values based on the context in which the code snippet is inserted.

注意

An expansion function represents either a single value or a list of values but it cannot represent both.

Notes to Implementers

A language service implements this interface to represent an expansion function. For each distinct expansion function supported, the language service must return a unique implementation of this interface. For example, if the language service supports two expansion functions, say, GetLocalName and GetNextClassName, it must implement a separate class to the IVsExpansionFunction interface for each expansion function. Then, the language service must return an instance of each class for each expansion function.

Notes to Callers

An IVsExpansionFunction object is returned from the GetExpansionFunction method in the IVsExpansionClient interface.

See Also

Reference

Microsoft.VisualStudio.TextManager.Interop Namespace

Other Resources

Function Element (IntelliSense Code Snippets)