ICompletionDefaultsSource.GetSessionDefaultsAsync(ITextView) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a list of possible default items from any prediction displayed in the view.
public System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<string>> GetSessionDefaultsAsync(Microsoft.VisualStudio.Text.Editor.ITextView view);
abstract member GetSessionDefaultsAsync : Microsoft.VisualStudio.Text.Editor.ITextView -> System.Threading.Tasks.Task<System.Collections.Immutable.ImmutableArray<string>>
Public Function GetSessionDefaultsAsync (view As ITextView) As Task(Of ImmutableArray(Of String))
Parameters
- view
- ITextView
View for which the defaults are desired.
Returns
A list of possible default item insertion texts for the completion session that do not account for the completion session's applicableTo span (see below).
Remarks
The returned list can contain items that are not items in the completion list. In general, the first item that matches something in the completion list should be used as the default selection (and this item should be soft-selected and not hard-selected).
The return prediction does not include text contained in the completion sessions applicableTo span. Suppose that the user has a prediction of ".WriteLine();" displayed and quickly types ".Wr" before completion spins up. In that case, the prediction would have changed to "iteLine();" and the completion session's applicableTo span should contain "Wr". The returned prediction will be "iteLine" -- no leading "Wr" and no trailing "();" -- so the caller will need to prepend it with "Wr" from the applicableTo span (and then match that to a CompletionItem to set the default selection).