Share via


ISelectedItemProvider.GetSelectedItemAsync Method

Definition

Gets currently selected CompletionItem in accordance with GetSelectedItemOptions. Supplied options indicates the ration between wait length and accuracy of returned CompletionItem: The shorter wait comes with a tradeoff of receiving a potentially stale item or no item.

Passing GetLastAvailableItem leads to returning: Currently selected CompletionItem when completion is not changing; Currently selected CompletionItem when completion is reacting to user's input; null when completion user interface has not appeared yet. This is the fastest operation and does not yield current thread.

Passing WaitForComputation leads to returning: Currently selected CompletionItem when completion is not changing; CompletionItem which is going to be selected after reacting to user's input, if completion user interface is already visible; null when completion user interface has not appeared yet. This accommodates for selection after user types and scrolls with arrow keys, and may yield current thread for a short period of time.

Passing WaitForContextAndComputation leads to returning: Currently selected CompletionItem when completion is not changing; CompletionItem which is going to be selected after receiving items from the providers, sorting them, and reacting to outstanding user's input. This yields current thread until completion items are received and selected item is calculated.

public:
 System::Threading::Tasks::Task<Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::Data::CompletionItem ^> ^ GetSelectedItemAsync(Microsoft::VisualStudio::Language::Intellisense::AsyncCompletion::Data::GetSelectedItemOptions options, System::Threading::CancellationToken cancel);
public System.Threading.Tasks.Task<Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionItem?> GetSelectedItemAsync (Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.GetSelectedItemOptions options, System.Threading.CancellationToken cancel);
abstract member GetSelectedItemAsync : Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.GetSelectedItemOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionItem>
Public Function GetSelectedItemAsync (options As GetSelectedItemOptions, cancel As CancellationToken) As Task(Of CompletionItem)

Parameters

options
GetSelectedItemOptions

Indicates the ratio between wait length and accuracy of returned CompletionItem

cancel
CancellationToken

Token for cancelling this request

Returns

Currently selected CompletionItem or null

Applies to