IAsyncCompletionBroker Interface

Definition

Represents a class that manages the completion feature. The editor uses this class to trigger completion and obtain instance of IAsyncCompletionSession which contains methods and events relevant to the active completion session.

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

Examples

[Import]
IAsyncCompletionBroker CompletionBroker;

Remarks

This is a MEF component and may be imported by another MEF component:

Methods

GetAggregatedCompletionContextAsync(ITextView, CompletionTrigger, SnapshotPoint, CancellationToken)

Requests CompletionContexts from applicable IAsyncCompletionSources and aggregates them. Does not trigger completion, does not raise events, does not open the completion GUI. The IAsyncCompletionSession which interacted with IAsyncCompletionSources is returned as InertSession and does not have full capabilities of IAsyncCompletionSession.

This method can be invoked from any thread, but it briefly switches to UI thread. Returns Empty when token is canceled.

GetSession(ITextView)

Returns IAsyncCompletionSession if there is one active in a given ITextView, or null if not.

IsCompletionActive(ITextView)

Returns whether IAsyncCompletionSession is active in given ITextView.

IsCompletionSupported(IContentType)

Returns whether there are any completion item sources available for given IContentType. In practice, availability of completion item sources also depends on the text view roles. See IsCompletionSupported(IContentType, ITextViewRoleSet).

IsCompletionSupported(IContentType, ITextViewRoleSet)

Returns whether there are any completion item sources available for given IContentType and ITextViewRoleSet. This method should be called prior to calling TriggerCompletion(ITextView, CompletionTrigger, SnapshotPoint, CancellationToken) to avoid traversal of the buffer graph in cases where completion would be unavailable.

TriggerCompletion(ITextView, CompletionTrigger, SnapshotPoint, CancellationToken)

Activates completion and returns IAsyncCompletionSession. If completion was already active, returns the existing session without changing it. Returns null when token is canceled, there are no participating IAsyncCompletionSources or completion is not applicable at the given triggerLocation. Must be invoked on UI thread. This does not cause the completion popup to appear. To compute available icons and display the UI, call OpenOrUpdate(CompletionTrigger, SnapshotPoint, CancellationToken). Invoke IsCompletionSupported(IContentType) prior to invoking this method to more efficiently verify whether feature is disabled or if there are no completion providers.

TriggerCompletion(ITextView, SnapshotPoint, Char, CancellationToken)

Activates completion and returns IAsyncCompletionSession. If completion was already active, returns the existing session without changing it. Must be invoked on UI thread. This does not cause the completion popup to appear. To compute available icons and display the UI, call OpenOrUpdate(InitialTrigger, SnapshotPoint, CancellationToken). Invoke IsCompletionSupported(IContentType) prior to invoking this method to more efficiently verify whether feature is disabled or if there are no completion providers.

Events

CompletionTriggered

Raised on UI thread when new IAsyncCompletionSession is triggered.

Applies to