Freigeben über


IAsyncCompletionSource Interface

Definition

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

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

Remarks

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

This object initializes IAsyncCompletionSession first through InitializeCompletion(CompletionTrigger, SnapshotPoint, CancellationToken) and then provides CompletionItems through GetCompletionContextAsync(IAsyncCompletionSession, CompletionTrigger, SnapshotPoint, SnapshotSpan, CancellationToken).

Methods

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.

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.

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.

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.

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.

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.

Applies to