次の方法で共有


IVsExpansionClient Interface

Allows a VSPackage to participate in the code snippet insertion process.

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

Syntax

'宣言
<GuidAttribute("9DD0F39A-9502-4068-93B7-B6ADAB33ECD8")> _
<InterfaceTypeAttribute()> _
Public Interface IVsExpansionClient
[GuidAttribute("9DD0F39A-9502-4068-93B7-B6ADAB33ECD8")]
[InterfaceTypeAttribute()]
public interface IVsExpansionClient
[GuidAttribute(L"9DD0F39A-9502-4068-93B7-B6ADAB33ECD8")]
[InterfaceTypeAttribute()]
public interface class IVsExpansionClient
[<GuidAttribute("9DD0F39A-9502-4068-93B7-B6ADAB33ECD8")>]
[<InterfaceTypeAttribute()>]
type IVsExpansionClient =  interface end
public interface IVsExpansionClient

The IVsExpansionClient type exposes the following members.

Methods

  Name Description
Public method EndExpansion Called to signal the end of the code snippet insertion and editing phase.
Public method FormatSpan Called to format the specified span in the specified text buffer.
Public method GetExpansionFunction Called to obtain an expansion function for the specified code snippet.
Public method IsValidKind Called to verify that the specified location can accept the specified kind of snippet.
Public method IsValidType Called to verify that the specified location can accept the specified types of code snippets.
Public method OnAfterInsertion Called after the code snippet has been inserted and formatted.
Public method OnBeforeInsertion Called before the code snippet has been inserted.
Public method OnItemChosen Called when a code snippet name has been selected from an IntelliSense menu.
Public method PositionCaretForEditing Called to position the edit caret in the specified place in a code snippet after it has been inserted and formatted.

Top

Remarks

This interface is used by clients of the code snippet manager to:

  • Receive before and after notifications during the insertion process.

  • Format the code snippet after it is inserted.

  • Verify that the snippet can be inserted at a given location.

  • Initiate a code snippet insertion in response to an IntelliSense menu selection of a code snippet.

  • Position the edit caret after a code snippet has been inserted.

Notes to Implementers

This interface is implemented by a VSPackage that supports insertion of code snippets. If you support the use of the InvokeInsertionUI method in the IVsExpansionManager interface (typically through a custom menu action that your VSPackage installs), then you must implement the IVsExpansionClient interface and the OnItemChosen method. Otherwise, you do not need to implement the IVsExpansionClient interface unless you need to verify the placement of code snippets or you support automatic formatting of source code.

Note

If you implement the IVsExpansionClient interface to support the OnItemChosen method, your class implementation should obtain and store the IVsExpansion interface from the IVsTextBuffer object before the InvokeInsertionUI method is called as the IVsExpansion interface is needed to complete the implementation of the OnItemChosen interface.

Notes to Callers

This interface is instantiated and passed to the InvokeInsertionUI method in the IVsExpansionManager interface. This interface is also instantiated and passed to the methods in the IVsExpansion interface.

See Also

Reference

Microsoft.VisualStudio.TextManager.Interop Namespace