다음을 통해 공유


IAsyncCompletionCommitManager.TryCommit Method

Definition

Overloads

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.

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.

public:
 Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::Data::CommitResult TryCommit(Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::IAsyncCompletionSession ^ session, Microsoft::VisualStudio::Text::ITextBuffer ^ buffer, Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::Data::CompletionItem ^ item, char typedChar, System::Threading::CancellationToken token);
public Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CommitResult TryCommit (Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSession session, Microsoft.VisualStudio.Text.ITextBuffer buffer, Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionItem item, char typedChar, System.Threading.CancellationToken token);
abstract member TryCommit : Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSession * Microsoft.VisualStudio.Text.ITextBuffer * Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionItem * char * System.Threading.CancellationToken -> Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CommitResult
Public Function TryCommit (session As IAsyncCompletionSession, buffer As ITextBuffer, item As CompletionItem, typedChar As Char, token As CancellationToken) As CommitResult

Parameters

buffer
ITextBuffer

Subject buffer which matches this IAsyncCompletionCommitManager's content type

item
CompletionItem

Which CompletionItem is to be committed

typedChar
Char

Text change associated with this commit. \t denotes Tab key, \n denotes Return key and \0 denotes programmatic commit

token
CancellationToken

Token used to cancel this operation

Returns

Instruction for the editor how to proceed after invoking this method. Default is Unhandled

Applies to

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.

public:
 Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::Data::CommitResult TryCommit(Microsoft::VisualStudio::Text::Editor::ITextView ^ view, Microsoft::VisualStudio::Text::ITextBuffer ^ buffer, Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::Data::CompletionItem ^ item, Microsoft::VisualStudio::Text::ITrackingSpan ^ applicableToSpan, char typedChar, System::Threading::CancellationToken token);
public Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CommitResult TryCommit (Microsoft.VisualStudio.Text.Editor.ITextView view, Microsoft.VisualStudio.Text.ITextBuffer buffer, Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionItem item, Microsoft.VisualStudio.Text.ITrackingSpan applicableToSpan, char typedChar, System.Threading.CancellationToken token);
abstract member TryCommit : Microsoft.VisualStudio.Text.Editor.ITextView * Microsoft.VisualStudio.Text.ITextBuffer * Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionItem * Microsoft.VisualStudio.Text.ITrackingSpan * char * System.Threading.CancellationToken -> Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CommitResult
Public Function TryCommit (view As ITextView, buffer As ITextBuffer, item As CompletionItem, applicableToSpan As ITrackingSpan, typedChar As Char, token As CancellationToken) As CommitResult

Parameters

view
ITextView

View that hosts completion and relevant buffers

buffer
ITextBuffer

Reference to the buffer with matching content type to perform text edits etc.

item
CompletionItem

Which completion item is to be applied

applicableToSpan
ITrackingSpan

Span augmented by completion, on the view's data buffer: TextBuffer

typedChar
Char

Text change associated with this commit

token
CancellationToken

Token used to cancel this operation

Returns

Instruction for the editor how to proceed after invoking this method. Default is Unhandled

Applies to