Click or drag to resize

CompletionContext Class

The context presented to a CompletionProvider when providing completions.
Inheritance Hierarchy

Namespace:  Microsoft.CodeAnalysis.Completion
Assembly:  Microsoft.CodeAnalysis.Features (in Microsoft.CodeAnalysis.Features.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
public sealed class CompletionContext

The CompletionContext type exposes the following members.

Public methodCompletionContext
Creates a CompletionContext instance.
Public propertyCancellationToken
The cancellation token to use for this operation.
Public propertyCompletionListSpan
The span of the document the completion list corresponds to. It will be set initially to the result of GetDefaultCompletionListSpan(SourceText, Int32), but it can be overwritten bduring GetCompletionsAsync(Document, Int32, CompletionTrigger, ImmutableHashSetString, OptionSet, CancellationToken). The purpose of the span is to: 1. Signify where the completions should be presented. 2. Designate any existing text in the document that should be used for filtering. 3. Specify, by default, what portion of the text should be replaced when a completion item is committed.
Public propertyDefaultItemSpan Obsolete.
The span of the syntax element at the caret position. This is the most common value used for Span and will be automatically assigned to any CompletionItem that has no Span specified.
Public propertyDocument
The document that completion was invoked within.
Public propertyIsExclusive
Set to true if the items added here should be the only items presented to the user.
Public propertyOptions
The options that completion was started with.
Public propertyPosition
The caret position when completion was triggered.
Public propertySuggestionModeItem
An optional CompletionItem that appears selected in the list presented to the user during suggestion mode. Suggestion mode disables autoselection of items in the list, giving preference to the text typed by the user unless a specific item is selected manually. Specifying a SuggestionModeItem is a request that the completion host operate in suggestion mode. The item specified determines the text displayed and the description associated with it unless a different item is manually selected. No text is ever inserted when this item is completed, leaving the text the user typed instead.
Public propertyTrigger
The triggering action that caused completion to be started.
Public methodAddItem
Public methodAddItems
See Also