다음을 통해 공유


IAsyncCompletionUniversalSource Interface

Definition

Represents an object that provides CompletionItems and other information relevant to the completion feature at a specific SnapshotPoint.

This object provides CompletionItems without prior initialization. Only GetCompletionContextAsync(CompletionTrigger, SnapshotPoint, CancellationToken) will be called. Methods of base interface IAsyncCompletionSource may return default results.

public interface class IAsyncCompletionUniversalSource : Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::IAsyncCompletionSource
public interface IAsyncCompletionUniversalSource : Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource
type IAsyncCompletionUniversalSource = interface
    interface IAsyncCompletionSource
Public Interface IAsyncCompletionUniversalSource
Implements IAsyncCompletionSource
Implements

Remarks

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

Methods

GetCompletionContextAsync(CompletionTrigger, SnapshotPoint, CancellationToken)

Called to fetch set of all completion items available at a given location, without pre-existing completion session. Called on a background thread.

GetCompletionContextAsync(IAsyncCompletionSession, CompletionTrigger, SnapshotPoint, SnapshotSpan, CancellationToken)

Called once per completion session to fetch the set of all completion items available at a given location. Called on a background thread.

(Inherited from IAsyncCompletionSource)
GetCompletionContextAsync(InitialTrigger, SnapshotPoint, SnapshotSpan, CancellationToken)

Called once per completion session to fetch the set of all completion items available at a given location. Called on a background thread.

(Inherited from IAsyncCompletionSource)
GetDescriptionAsync(CompletionItem, CancellationToken)

Returns tooltip associated with provided CompletionItem. The returned object will be rendered by IViewElementFactoryService. See its documentation for default supported types. You may export a IViewElementFactory to provide a renderer for a custom type. Since this method is called on a background thread and on multiple platforms, an instance of UIElement may not be returned.

(Inherited from IAsyncCompletionSource)
GetDescriptionAsync(IAsyncCompletionSession, CompletionItem, CancellationToken)

Returns tooltip associated with provided CompletionItem. The returned object will be rendered by IViewElementFactoryService. See its documentation for default supported types. You may export a IViewElementFactory to provide a renderer for a custom type. Since this method is called on a background thread and on multiple platforms, an instance of UIElement may not be returned.

(Inherited from IAsyncCompletionSource)
HandleTypedChar(IAsyncCompletionSession, CompletionItem, SnapshotPoint, Char, CancellationToken)

Returns how typedChar should influence the session, given selectedItem which was supplied by this IAsyncCompletionUniversalSource.

Called instead of ShouldCommitCompletion(IAsyncCompletionSession, SnapshotPoint, Char, CancellationToken) and instead of HandleTypedChar(IAsyncCompletionSession, SnapshotPoint, Char, CancellationToken) if selected item's Source is IAsyncCompletionUniversalSource.

Called on UI thread.

InitializeCompletion(CompletionTrigger, SnapshotPoint, CancellationToken)

Provides the span applicable to the prospective session. Called on UI thread and expected to return very quickly, based on syntactic clues. This method is called as a result of user action, after the Editor makes necessary changes in direct response to user's action. The state of the Editor prior to making the text edit is captured in ViewSnapshotBeforeTrigger of trigger. This method is called sequentially on available IAsyncCompletionSources until one of them returns CompletionStartData with appropriate level of Participation and one returns CompletionStartData with ApplicableToSpan If neither of the above conditions are met, no completion session will start.

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

TryGetApplicableToSpan(Char, SnapshotPoint, SnapshotSpan, CancellationToken)

Provides the span applicable to the prospective session. Called on UI thread and expected to return very quickly, based on textual information. This method is called sequentially on available IAsyncCompletionSources until one of them returns true. Returning false does not exclude this source from participating in completion session. If no IAsyncCompletionSources return true, there will be no completion session.

(Inherited from IAsyncCompletionSource)

Applies to