Udostępnij za pośrednictwem


IAsyncCompletionCommitManager2 Interface

Definition

Represents a class that provides means to handle typed characters by commiting the IAsyncCompletionSession, dismissing it or allowing it to continue.

public interface class IAsyncCompletionCommitManager2 : Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::IAsyncCompletionCommitManager
public interface IAsyncCompletionCommitManager2 : Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionCommitManager
type IAsyncCompletionCommitManager2 = interface
    interface IAsyncCompletionCommitManager
Public Interface IAsyncCompletionCommitManager2
Implements IAsyncCompletionCommitManager
Implements

Remarks

When object implements IAsyncCompletionCommitManager2, completion will not call PotentialCommitCharacters and ShouldCommitCompletion(IAsyncCompletionSession, SnapshotPoint, Char, CancellationToken).

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.

(Inherited from IAsyncCompletionCommitManager)

Methods

HandleTypedChar(IAsyncCompletionSession, SnapshotPoint, Char, CancellationToken)

Returns how typedChar should influence the session.

Called instead of ShouldCommitCompletion(IAsyncCompletionSession, SnapshotPoint, Char, CancellationToken)

Called on UI thread.

Initialize(IAsyncCompletionSession)

Invoked when session is initialized.

Called on UI thread.

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.

(Inherited from IAsyncCompletionCommitManager)
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.

(Inherited from IAsyncCompletionCommitManager)
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.

(Inherited from IAsyncCompletionCommitManager)
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.

(Inherited from IAsyncCompletionCommitManager)

Applies to