共用方式為


IAsyncCompletionCommitManager Interface

Definition

Represents a class that provides means to adjust the commit behavior, including which typed characters commit the IAsyncCompletionSession and how to commit CompletionItems.

public interface class IAsyncCompletionCommitManager
public interface IAsyncCompletionCommitManager
type IAsyncCompletionCommitManager = interface
Public Interface IAsyncCompletionCommitManager
Derived

Remarks

Instances of this class should be created by IAsyncCompletionCommitManagerProvider, which is a MEF part.

Properties

PotentialCommitCharacters

Returns characters that may commit completion.

When completion is active and a text edit matches one of these characters, ShouldCommitCompletion(IAsyncCompletionSession, SnapshotPoint, Char, CancellationToken) is called to verify that the character is indeed a commit character at a given location.

Called on UI thread.

If the commit charactersr are not known or are variable, consider using IAsyncCompletionCommitManager2 which ignores the PotentialCommitCharacters optimization and supports handling each character individually.

Methods

ShouldCommitCompletion(Char, SnapshotPoint, CancellationToken)

Returns whether this character is a commit character in a given location. If every character returned by PotentialCommitCharacters should always commit the active completion session, return true. Called on UI thread.

ShouldCommitCompletion(IAsyncCompletionSession, SnapshotPoint, Char, CancellationToken)

Returns whether typedChar is a commit character at a given location.

If in your language every character returned by PotentialCommitCharacters is a commit character, simply return true.

Called on UI thread.

TryCommit(IAsyncCompletionSession, ITextBuffer, CompletionItem, Char, CancellationToken)

Allows the implementer of IAsyncCompletionCommitManager to customize how specified CompletionItem is committed. This method is called on UI thread, before the typedChar is inserted into the buffer.

In most cases, implementer does not need to commit the item. Return Unhandled to allow another IAsyncCompletionCommitManager to attempt the commit, or to invoke the default commit behavior.

To perform a custom commit, replace contents of buffer at a location indicated by ApplicableToSpan with text stored in InsertText. To move the caret, use TextView. Finally, return Handled. Use Behavior to influence Editor's behavior after invoking this method.

typedChar may be a non-printable character to denote a commit gesture other than typing. \t denotes pressing Tab key, \n denotes pressing Return key and \0 denotes programmatic commit through API, Ctrl+Space gesture or double clicking an item.

Called on UI thread.

TryCommit(ITextView, ITextBuffer, CompletionItem, ITrackingSpan, Char, CancellationToken)

Allows the instance of IAsyncCompletionCommitManager to commit of specified CompletionItem. Implementer does not need to commit the item. Return Unhandled to allow another IAsyncCompletionCommitManager to attempt the commit, or to invoke default commit behavior. Called on UI thread.

Applies to