IAsyncCompletionSource.InitializeCompletion Method

Definition

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.

public:
 Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::Data::CompletionStartData InitializeCompletion(Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::Data::CompletionTrigger trigger, Microsoft::VisualStudio::Text::SnapshotPoint triggerLocation, System::Threading::CancellationToken token);
public Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionStartData InitializeCompletion (Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionTrigger trigger, Microsoft.VisualStudio.Text.SnapshotPoint triggerLocation, System.Threading.CancellationToken token);
abstract member InitializeCompletion : Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionTrigger * Microsoft.VisualStudio.Text.SnapshotPoint * System.Threading.CancellationToken -> Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionStartData
Public Function InitializeCompletion (trigger As CompletionTrigger, triggerLocation As SnapshotPoint, token As CancellationToken) As CompletionStartData

Parameters

trigger
CompletionTrigger

What causes the completion, including the character typed and reference to TextSnapshot prior to triggering the completion

triggerLocation
SnapshotPoint

Location on the subject buffer that matches this IAsyncCompletionSource's content type

token
CancellationToken

Cancellation token that may interrupt this operation

Returns

Whether this IAsyncCompletionSource wishes to participate in completion.

Remarks

If a language service does not wish to participate in completion, it should try to provide a valid ApplicableToSpan and set Participation to false. This will enable other extensions to provide completion in syntactically appropriate location.

Applies to