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)

[InterfaceTypeAttribute(1)]
[GuidAttribute("563011A2-1611-48ED-B3B1-189060064F66")]
public interface IVsExpansionFunction

NameDescription
System_CAPS_pubmethodFieldChanged(String, Int32)

Called when another field in the inserted code snippet is changed.

System_CAPS_pubmethodGetCurrentValue(String, Int32)

Returns the current value of the expansion function.

System_CAPS_pubmethodGetDefaultValue(String, Int32)

Returns the default string to be inserted before any template is edited.

System_CAPS_pubmethodGetFunctionType(UInt32)

Returns the type of this expansion function (value or list of values).

System_CAPS_pubmethodGetListCount(Int32)

Returns the number of items in the list of values associated with the expansion function.

System_CAPS_pubmethodGetListText(Int32, String)

Returns the specified value from a list of values associated with the expansion function.

System_CAPS_pubmethodReleaseFunction()

Called when the expansion function is no longer needed.

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 for details on how expansion functions are declared in a code snippet file.572c5549-5821-4e15-8ecd-0fa86c1c65df

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.

System_CAPS_noteNote

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.

Return to top
Show: