Partager via


IVsExpansionSession Interface

Definition

Represents the state of a newly inserted code snippet that is being edited by the user.

public interface class IVsExpansionSession
public interface class IVsExpansionSession
__interface IVsExpansionSession
[System.Runtime.InteropServices.Guid("3DFA7603-3B51-4484-81CD-FF1470123C7C")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsExpansionSession
[System.Runtime.InteropServices.Guid("3DFA7603-3B51-4484-81CD-FF1470123C7C")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsExpansionSession
[<System.Runtime.InteropServices.Guid("3DFA7603-3B51-4484-81CD-FF1470123C7C")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsExpansionSession = interface
[<System.Runtime.InteropServices.Guid("3DFA7603-3B51-4484-81CD-FF1470123C7C")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsExpansionSession = interface
Public Interface IVsExpansionSession
Attributes

Remarks

This interface provides a number of useful methods to support the special code snippet edit mode as well as gaining access to the code snippet XML elements.

Code Snippet Edit Mode

After a code snippet has been inserted into the source document, a special edit mode is enabled that supports tabbing between multiple fields of the code snippet as well as selecting from lists of values associated with fields. The special edit mode is ended when the user types Enter or ESC. If this special edit mode is supported, it must be implemented by the language service that supports the code snippet. Otherwise, the language service should call the EndCurrentExpansion method on this interface to indicate that the code snippet has been accepted and nothing further needs to be done to the snippet.

Notes to Implementers

This interface is implemented by the same entity that implements the IVsExpansion interface (which in turn is implemented on an IVsTextBuffer object).

Notes to Callers

This interface is returned from the following methods:

The IVsExpansionSession interface is used to implement the snippet special edit mode and is passed to the OnBeforeInsertion(IVsExpansionSession) and OnAfterInsertion(IVsExpansionSession) methods in the IVsExpansionClient interface.

Methods

EndCurrentExpansion(Int32)

Called to indicate the end of the current code snippet insertion process.

GetDeclarationNode(String, IXMLDOMNode)

Retrieves the declaration node for the specified field.

GetEndSpan(TextSpan[])

Returns the position at which the edit caret is to be placed when the code snippet is committed to the source buffer.

GetFieldSpan(String, TextSpan[])

Retrieves the span (the position and extent) of the specified field.

GetFieldValue(String, String)

Retrieves the value of the specified field.

GetHeaderNode(String, IXMLDOMNode)

Returns a node from the code snippet <Header> tag.

GetSnippetNode(String, IXMLDOMNode)

Returns a node from the code snippet <Snippet> tag.

GetSnippetSpan(TextSpan[])

Gets the span of the code snippet.

GoToNextExpansionField(Int32)

Move the highlight to the next field in order.

GoToPreviousExpansionField()

Move the highlight to the previous field in order.

SetEndSpan(TextSpan)

Sets the position where the edit caret should be placed when the code snippet is committed to the source buffer.

SetFieldDefault(String, String)

Sets the default value for the specified field.

Applies to