Partager via


Source.GetExpansionProvider Method

Definition

Gets an expansion provider in support of code snippets.

public:
 virtual Microsoft::VisualStudio::Package::ExpansionProvider ^ GetExpansionProvider();
public virtual Microsoft.VisualStudio.Package.ExpansionProvider GetExpansionProvider ();
abstract member GetExpansionProvider : unit -> Microsoft.VisualStudio.Package.ExpansionProvider
override this.GetExpansionProvider : unit -> Microsoft.VisualStudio.Package.ExpansionProvider
Public Overridable Function GetExpansionProvider () As ExpansionProvider

Returns

If successful, returns an ExpansionProvider object; otherwise, returns null (code snippet expansion is not supported).

Remarks

A code snippet is a piece of code that is inserted at the current position in the source file, either as a result of typing a completion character (which shows a list of possible completion words that include code snippet names) or selecting Insert Snippet from the IntelliSense menu. If you need to support functionality beyond what the base ExpansionProvider class supports, you must derive a class from the Source class and override this method to instantiate your own version of the ExpansionProvider class.

The base method returns an existing ExpansionProvider object or creates a new ExpansionProvider object, sets it as the existing object, and returns it.

This method is typically called from the Source constructor.

See Support for Code Snippets in a Legacy Language Service for more information about how this method is used.

Applies to