Freigeben über


IVsExpansionClient Interface

Definition

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

public interface class IVsExpansionClient
public interface class IVsExpansionClient
__interface IVsExpansionClient
[System.Runtime.InteropServices.Guid("9DD0F39A-9502-4068-93B7-B6ADAB33ECD8")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsExpansionClient
[System.Runtime.InteropServices.Guid("9DD0F39A-9502-4068-93B7-B6ADAB33ECD8")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsExpansionClient
[<System.Runtime.InteropServices.Guid("9DD0F39A-9502-4068-93B7-B6ADAB33ECD8")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsExpansionClient = interface
[<System.Runtime.InteropServices.Guid("9DD0F39A-9502-4068-93B7-B6ADAB33ECD8")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsExpansionClient = interface
Public Interface IVsExpansionClient
Derived
Attributes

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(IVsTextView, IVsExpansionClient, Guid, String[], Int32, Int32, String[], Int32, Int32, String, String) 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(String, String) 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.


If you implement the IVsExpansionClient interface to support the OnItemChosen(String, String) method, your class implementation should obtain and store the IVsExpansion interface from the IVsTextBuffer object before the InvokeInsertionUI(IVsTextView, IVsExpansionClient, Guid, String[], Int32, Int32, String[], Int32, Int32, String, String) method is called as the IVsExpansion interface is needed to complete the implementation of the OnItemChosen(String, String) interface.

Notes to Callers

This interface is instantiated and passed to the InvokeInsertionUI(IVsTextView, IVsExpansionClient, Guid, String[], Int32, Int32, String[], Int32, Int32, String, String) method in the IVsExpansionManager interface. This interface is also instantiated and passed to the methods in the IVsExpansion interface.

Methods

EndExpansion()

Called to signal the end of the code snippet insertion and editing phase.

FormatSpan(IVsTextLines, TextSpan[])

Called to format the specified span in the specified text buffer.

GetExpansionFunction(IXMLDOMNode, String, IVsExpansionFunction)

Called to obtain an expansion function for the specified code snippet.

IsValidKind(IVsTextLines, TextSpan[], String, Int32)

Called to verify that the specified location can accept the specified kind of snippet.

IsValidType(IVsTextLines, TextSpan[], String[], Int32, Int32)

Called to verify that the specified location can accept the specified types of code snippets.

OnAfterInsertion(IVsExpansionSession)

Called after the code snippet has been inserted and formatted.

OnBeforeInsertion(IVsExpansionSession)

Called before the code snippet has been inserted.

OnItemChosen(String, String)

Called when a code snippet name has been selected from an IntelliSense menu.

PositionCaretForEditing(IVsTextLines, TextSpan[])

Called to position the edit caret in the specified place in a code snippet after it has been inserted and formatted.

Applies to