-
Notifications
You must be signed in to change notification settings - Fork 33
Modern completion API
Doc comments for 15.7.80-preview-g8bc2e9da81
#
- CompletionClosedEventArgs
- CompletionContext
- CompletionFilter
- CompletionFilterChangedEventArgs
- CompletionFilterReason
- CompletionFilterWithState
-
CompletionItem
- #ctor(displayText,source)
- #ctor(displayText,source,image,suffix)
- #ctor(displayText,source,image,suffix)
- #ctor(displayText,source,image,suffix)
- #ctor(displayText,source,image,suffix)
- #ctor(displayText,insertText,sortText,filterText,source,filters,useCustomCommit,image,suffix,attributeimages)
- AttributeIcons
- DisplayText
- Filters
- FilterText
- Image
- InsertText
- Properties
- SortText
- Source
- Suffix
- UseCustomCommit
- CompletionItemEventArgs
- CompletionItemSelectedEventArgs
- CompletionItemSelection
- CompletionItemsWithHighlightEventArgs
- CompletionItemWithHighlight
- CompletionPresentationViewModel
- CompletionTrigger
- CompletionTriggerReason
- FilteredCompletionModel
- IAsyncCompletionBroker
- IAsyncCompletionItemSource
- IAsyncCompletionItemSourceProvider
- IAsyncCompletionService
- IAsyncCompletionServiceProvider
- IAsyncCompletionSession
- IAsyncQuickInfoBroker
- IAsyncQuickInfoSession
- IAsyncQuickInfoSource
- IAsyncQuickInfoSourceProvider
- ICompletionPresenter
- ICompletionPresenterProvider
- IInteractiveQuickInfoContent
- ILegacyQuickInfoBrokerSupport
- ILegacyQuickInfoMetadata
- ILegacyQuickInfoSource
- ILegacyQuickInfoSourcesSupport
- QuickInfoItem
- QuickInfoSessionOptions
- QuickInfoSessionState
- QuickInfoSessionStateChangedEventArgs
Microsoft.VisualStudio.Language.Intellisense
This class is used to notify completion's logic when the UI closes
Constructs instance of CompletionClosedEventArgs.
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | ITextView that hosted this completion UI |
Microsoft.VisualStudio.Language.Intellisense
This type is used to transfer data from IAsyncCompletionItemSource to IAsyncCompletionBroker and further to IAsyncCompletionService
Constructs CompletionContext with CompletionItem applicable to a SnapshotSpan
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionItem} | Available completion items |
applicableSpan | Microsoft.VisualStudio.Text.SnapshotSpan | Completion list will be filtered by contents of this span |
#ctor(items,applicableToSpan,availableFilters,useSoftSelection,useSuggestionMode,suggestionModeDescription) constructor
# =
Constructs CompletionContext with CompletionItem applicable to a SnapshotSpan, CompletionFilter available for these items and instructions on suggestion mode and soft selection.
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionItem} | Available completion items |
applicableToSpan | Microsoft.VisualStudio.Text.SnapshotSpan | Completion list will be filtered by contents of this span |
availableFilters | System.Boolean | Completion filters available for these completion items |
useSoftSelection | System.Boolean | Whether UI should use soft selection |
useSuggestionMode | System.String | Whether UI should enter suggestion mode |
Location pertinent to the completion items
Set of completion items available at a location
Displayed when UI is in suggestion mode, yet there is no code to suggest
When set to true, the completion list will be initially soft-selected. Soft selection means that typing commit characters will not commit the item. The item may be committed only by using TAB or double-clicking. Soft selection is represented by a border around the item, without a background fill. Selecting another item automatically disables soft selection and enables full selection.
When set to true, the completion list will be in the "builder" mode, such that hitting Space will not commit it, but append it to the constructed item.
Microsoft.VisualStudio.Language.Intellisense
Identifies a filter that toggles exclusive display of CompletionItems that reference it.
static CompletionFilter MyFilter = new CompletionFilter("My items", "m", MyItemsImageMoniker);
These instances should be singletons. All CompletionItems that should be filtered using the same filter button must use the same reference to the instance of CompletionFilter.
Constructs an instance of CompletionFilter.
Name | Type | Description |
---|---|---|
displayText | System.String | Name of this filter |
accessKey | System.String | Key used in a keyboard shortcut that toggles this filter. |
image | Microsoft.VisualStudio.Language.Intellisense.AccessibleImageId | ImageId that represents this filter |
Key used in a keyboard shortcut that toggles this filter.
Name of this filter.
AccessibleImageId that represents this filter.
Microsoft.VisualStudio.Language.Intellisense
This class is used to notify completion's logic of selection change in the filter UI
Constructs instance of CompletionFilterChangedEventArgs.
Name | Type | Description |
---|---|---|
filters | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilterWithState} | Current state of the filters |
Current state of the filters
Microsoft.VisualStudio.Language.Intellisense
Describes the kind of action that triggered completion to filter.
Completion was triggered via an action deleting a character from the document.
Update was triggered by changing filters
Completion was triggered by a direct invocation of the completion feature using the Edit.ListMember command.
Completion was triggered via an action inserting a character into the document.
Microsoft.VisualStudio.Language.Intellisense
Immutable data transfer object used to communicate between the completion session and completion UI
Constructs a new instance of CompletionFilterWithState.
Name | Type | Description |
---|---|---|
filter | Microsoft.VisualStudio.Language.Intellisense.CompletionFilter | Reference to CompletionFilter |
isAvailable | System.Boolean | Whether this CompletionFilter is available |
Constructs a new instance of CompletionFilterWithState when selected state is known.
Name | Type | Description |
---|---|---|
filter | Microsoft.VisualStudio.Language.Intellisense.CompletionFilter | Reference to CompletionFilter |
isAvailable | System.Boolean | Whether this CompletionFilter is available |
isSelected | System.Boolean | Whether this CompletionFilter is selected |
Reference to the completion filter
Whether the filter is available. Filter should be available when there are visible CompletionItems that define this Filter in their Filters
Whether the filter is selected by the user.
Returns instance of CompletionFilterWithState with specified IsAvailable
Updated instance of CompletionFilterWithState
Name | Type | Description |
---|---|---|
isAvailable | System.Boolean | Value to use for IsAvailable |
Returns instance of CompletionFilterWithState with specified IsSelected
Updated instance of CompletionFilterWithState
Name | Type | Description |
---|---|---|
availability | System.Boolean | Value to use for IsSelected |
Microsoft.VisualStudio.Language.Intellisense
This class, returned from IAsyncCompletionItemSource, represents a single entry to be displayed in the completion UI. This class implements IPropertyOwner
Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, and there are no image, filter, suffix, attribute images nor custom commit behavior associated with this item.
Name | Type | Description |
---|---|---|
displayText | System.String | Text to use in the UI, when sorting, filtering and completing |
source | Microsoft.VisualStudio.Language.Intellisense.IAsyncCompletionItemSource | Reference to IAsyncCompletionItemSource that created this item |
Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, and there are no filter, suffix, attribute images, suffix nor custom commit behavior associated with this item.
Name | Type | Description |
---|---|---|
displayText | System.String | Text to use in the UI, when sorting, filtering and completing |
source | Microsoft.VisualStudio.Language.Intellisense.IAsyncCompletionItemSource | Reference to IAsyncCompletionItemSource that created this item |
image | Microsoft.VisualStudio.Language.Intellisense.AccessibleImageId | Image displayed in the UI |
Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, filters, and there are no suffix, attribute images nor custom commit behavior associated with this item.
Name | Type | Description |
---|---|---|
displayText | System.String | Text to use in the UI, when sorting, filtering and completing |
source | Microsoft.VisualStudio.Language.Intellisense.IAsyncCompletionItemSource | Reference to IAsyncCompletionItemSource that created this item |
image | Microsoft.VisualStudio.Language.Intellisense.AccessibleImageId | Image displayed in the UI |
suffix | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilter} | Additional text to display in the UI |
Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, filters, suffix, and there are no custom commit behavior nor attribute images associated with this item.
Name | Type | Description |
---|---|---|
displayText | System.String | Text to use in the UI, when sorting, filtering and completing |
source | Microsoft.VisualStudio.Language.Intellisense.IAsyncCompletionItemSource | Reference to IAsyncCompletionItemSource that created this item |
image | Microsoft.VisualStudio.Language.Intellisense.AccessibleImageId | Image displayed in the UI |
suffix | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilter} | Additional text to display in the UI |
Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, filters, suffix, custom commit behavior and there are no attribute images associated with this item.
Name | Type | Description |
---|---|---|
displayText | System.String | Text to use in the UI, when sorting, filtering and completing |
source | Microsoft.VisualStudio.Language.Intellisense.IAsyncCompletionItemSource | Reference to IAsyncCompletionItemSource that created this item |
image | Microsoft.VisualStudio.Language.Intellisense.AccessibleImageId | Image displayed in the UI |
suffix | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilter} | Additional text to display in the UI |
#ctor(displayText,insertText,sortText,filterText,source,filters,useCustomCommit,image,suffix,attributeimages) constructor
# =
Creates a completion item, allowing customization of all of its properties.
Name | Type | Description |
---|---|---|
displayText | System.String | Text used in the UI |
insertText | Microsoft.VisualStudio.Language.Intellisense.IAsyncCompletionItemSource | Text inserted when completing this item |
sortText | Microsoft.VisualStudio.Language.Intellisense.AccessibleImageId | Text used by IAsyncCompletionService when sorting against other items |
filterText | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilter} | Text used by IAsyncCompletionService when matching against the applicable span |
source | System.String | Reference to IAsyncCompletionItemSource that created this item |
filters | System.Boolean | ImmutableArray of references to CompletionFilters applicable to this item |
useCustomCommit | System.String | Whether or not to invoke item's Source's custom commit method when completing this item |
image | System.String | Image displayed in the UI |
suffix | System.String | Additional text to display in the UI |
attributeimages | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AccessibleImageId} | Additional images to display in the UI |
Additional images to display in the UI. Usually, these images are displayed on the far right side of the UI.
Text used in the UI
ImmutableArray of references to CompletionFilters applicable to this item
Text used by IAsyncCompletionService when matching against the applicable span
Image displayed in the UI
Text inserted when completing this item
The collection of properties controlled by the property owner. See Properties
Text used by IAsyncCompletionService when sorting against other items
Reference to the instance that will provide tooltip and custom commit method. Usually it is the same instance as the one that created this CompletionItem
Additional text to display in the UI, after DisplayText. This text has less emphasis than DisplayText and is usually right-aligned.
Whether or not to invoke item's Source's custom commit method when completing this item
Microsoft.VisualStudio.Language.Intellisense
This class is used to notify of an operation that affects a single CompletionItem.
Constructs instance of CompletionItemEventArgs.
This constructor has no parameters.
Relevant item
Microsoft.VisualStudio.Language.Intellisense
This class is used to notify completion's logic of selecting through the UI
Constructs instance of CompletionItemSelectedEventArgs.
Name | Type | Description |
---|---|---|
selectedItem | Microsoft.VisualStudio.Language.Intellisense.CompletionItem | User-selected item |
suggestionModeSelected | System.Boolean | Whether the selected item is a suggestion mode item |
Selected item. Might be null if there is no selection
Whether selected item is a suggestion mode item
Microsoft.VisualStudio.Language.Intellisense
Don't change the current selection mode.
Set selection mode to regular selection: item is committed using Tab, mouse, enter and commit characters.
Set selection mode to soft selection: item is committed only using Tab or mouse.
Microsoft.VisualStudio.Language.Intellisense
This class is used to notify of an operation that affects multiple CompletionItemWithHighlights.
Constructs instance of CompletionItemEventArgs.
This constructor has no parameters.
Relevant items
Microsoft.VisualStudio.Language.Intellisense
Wraps CompletionItem with information about highlighted parts of its DisplayText.
Constructs CompletionItemWithHighlight without any highlighting. Used when the CompletionItem appears in the completion list without being a text match.
Name | Type | Description |
---|---|---|
completionItem | Microsoft.VisualStudio.Language.Intellisense.CompletionItem | Instance of the CompletionItem |
Constructs CompletionItemWithHighlight with given highlighting. Used when text used to filter the completion list can be found in the DisplayText.
Name | Type | Description |
---|---|---|
completionItem | Microsoft.VisualStudio.Language.Intellisense.CompletionItem | Instance of the CompletionItem |
highlightedSpans | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Text.Span} | Spans of DisplayText to highlight |
The completion item
Which parts of DisplayText to highlight
Microsoft.VisualStudio.Language.Intellisense
This class contains completion items, filters and other pieces of information used by ICompletionPresenter to render the completion UI.
#ctor(items,filters,applicableSpan,useSoftSelection,useSuggestionMode,selectSuggestionMode,selectedItemIndex,suggestionModeItem) constructor
# =
Constructs CompletionPresentationViewModel
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionItemWithHighlight} | Completion items to display with their highlighted spans |
filters | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilterWithState} | Completion filters with their available and selected state |
applicableSpan | Microsoft.VisualStudio.Text.ITrackingSpan | Span pertinent to the completion session |
useSoftSelection | System.Boolean | Controls whether selected item should be soft selected |
useSuggestionMode | System.Boolean | Controls whether suggestion mode item is visible |
selectSuggestionMode | System.Boolean | Controls whether suggestion mode item is selected |
selectedItemIndex | System.Int32 | Controls which item is selected. Use -1 in suggestion mode |
suggestionModeItem | Microsoft.VisualStudio.Language.Intellisense.CompletionItem | Suggestion mode item to display |
Span pertinent to the completion session.
Completion filters with their available and selected state.
Completion items to display with their highlighted spans.
Controls which item is selected. Use -1 in suggestion mode.
Controls whether suggestion mode item is selected.
Text to display when SuggestionModeItem's InsertText is empty.
Suggestion mode item to display.
Controls whether selected item should be soft selected.
Controls whether suggestion mode item is visible.
Microsoft.VisualStudio.Language.Intellisense
What triggered the completion (but not where it happened)
Creates a CompletionTrigger associated with a text edit
Name | Type | Description |
---|---|---|
reason | Microsoft.VisualStudio.Language.Intellisense.CompletionTriggerReason | The kind of action that triggered completion to start |
character | System.Char | Character that triggered completion |
Creates a CompletionTrigger not associated with a text edit
Name | Type | Description |
---|---|---|
reason | Microsoft.VisualStudio.Language.Intellisense.CompletionTriggerReason | The kind of action that triggered completion to start |
The text edit associated with the triggering action.
The reason that completion was started.
Microsoft.VisualStudio.Language.Intellisense
Describes the kind of action that initially triggered completion to open.
Completion was triggered via an action deleting a character from the document.
Completion was triggered via an action inserting a character into the document.
Completion was triggered by a direct invocation of the completion feature using the Edit.ListMember command.
Completion was triggered with a request to commit if a single item would be selected using the Edit.CompleteWord command.
Completion was triggered for snippets only.
Microsoft.VisualStudio.Language.Intellisense
This class, returned from IAsyncCompletionService, contains completion items to display in the UI, recommended item to display, selection mode and available filters.
Constructs FilteredCompletionModel without completion filters.
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionItemWithHighlight} | Items to display in the completion UI. |
selectedItemIndex | System.Int32 | Recommended item index to select. |
Constructs FilteredCompletionModel with completion filters.
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionItemWithHighlight} | Items to display in the completion UI. |
selectedItemIndex | System.Int32 | Recommended item index to select. |
filters | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilterWithState} | Completion filters with their availability and selection state. |
Constructs FilteredCompletionModel with completion filters, indication regarding selection mode and the unique item
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionItemWithHighlight} | Items to display in the completion UI. |
selectedItemIndex | System.Int32 | Recommended item index to select. |
filters | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilterWithState} | Completion filters with their availability and selection state. |
selectionMode | Microsoft.VisualStudio.Language.Intellisense.CompletionItemSelection | Allows IAsyncCompletionService to influence the selection mode. |
uniqueItem | Microsoft.VisualStudio.Language.Intellisense.CompletionItem | Provides CompletionItem to commit using "commit if unique" command despite displaying more than one item. |
Completion filters with their availability and selection state.
Items to display in the completion UI.
Recommended item index to select. Presence of a suggestion mode item may override
Controls the selection mode of the selected item.
Optionally, provides an item that should be committed using the "commit if unique" command.
Microsoft.VisualStudio.Language.Intellisense
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.
[Import] IAsyncCompletionBroker CompletionBroker { get; set; }
Returns IAsyncCompletionSession if active or null if not
Name | Type | Description |
---|---|---|
view | Microsoft.VisualStudio.Text.Editor.ITextView | View that hosts completion and relevant buffers |
Returns whether completion is active in given view
Name | Type | Description |
---|---|---|
view | Microsoft.VisualStudio.Text.Editor.ITextView | View that hosts completion and relevant buffers |
Returns whether there are any completion item sources available for the top buffer in the provided view.
Name | Type | Description |
---|---|---|
view | Microsoft.VisualStudio.Text.Editor.ITextView | View to check for available completion source exports |
Returns whether completion should trigger as a result of the text edit.
True if completion should trigger
Name | Type | Description |
---|---|---|
view | Microsoft.VisualStudio.Text.Editor.ITextView | View that hosts completion and relevant buffers |
typeChar | System.Char | The text edit to evaluate |
triggerLocation | Microsoft.VisualStudio.Text.SnapshotPoint | Location of the text edit on the view's top buffer |
Activates completion and returns IAsyncCompletionSession. If completion was already active, returns the existing session without changing it.
Name | Type | Description |
---|---|---|
view | Microsoft.VisualStudio.Text.Editor.ITextView | View that hosts completion and relevant buffers |
triggerLocation | Microsoft.VisualStudio.Text.SnapshotPoint | Location of completion on the view's top buffer. Used to pick relevant IAsyncCompletionItemSources and IAsyncCompletionService |
Microsoft.VisualStudio.Language.Intellisense
Represents a class that provides CompletionItems and other information relevant to the completion feature at a specific SnapshotPoint.
Instances of this class should be created by IAsyncCompletionItemSourceProvider, which is a MEF part.
Custom commit behavior for completion item created by this completion item source. Called if UseCustomCommit is set.
Name | Type | Description |
---|---|---|
view | Microsoft.VisualStudio.Text.Editor.ITextView | View that hosts completion and relevant buffers |
buffer | Microsoft.VisualStudio.Text.ITextBuffer | Reference to the buffer with matching content type to perform text edits etc. |
item | Microsoft.VisualStudio.Language.Intellisense.CompletionItem | Which completion item is to be applied |
applicableSpan | Microsoft.VisualStudio.Text.ITrackingSpan | Span augmented by completion |
edit | System.Char | Text change associated with this commit |
Called once per completion session to fetch the set of all completion items available at a given location.
A struct that holds completion items and applicable span
Name | Type | Description |
---|---|---|
trigger | Microsoft.VisualStudio.Language.Intellisense.CompletionTrigger | What caused the completion |
triggerLocation | Microsoft.VisualStudio.Text.SnapshotPoint | Where completion was triggered |
Returns tooltip associated with provided completion item
Return type is pending what we agree to describe GUI in cross platform fashion
Name | Type | Description |
---|---|---|
item | Microsoft.VisualStudio.Language.Intellisense.CompletionItem |
Returns characters that may commit completion. When text edit matches one of these characters, ShouldCommitCompletion is called.
This method has no parameters.
Fired when a view, previously involved in completion, closes
Name | Type | Description |
---|---|---|
view | Microsoft.VisualStudio.Text.Editor.ITextView | View that closes |
Returns whether this character is a commit character in a given location.
Name | Type | Description |
---|---|---|
typeChar | System.Char | Character typed by the user |
location | Microsoft.VisualStudio.Text.SnapshotPoint | Location in the snapshot of the view's topmost buffer |
Returns whether this character is a trigger character in a given context
Name | Type | Description |
---|---|---|
typeChar | System.Char | Character typed by the user |
location | Microsoft.VisualStudio.Text.SnapshotPoint | Location in the snapshot of the view's topmost buffer |
Microsoft.VisualStudio.Language.Intellisense
Provides instances of IAsyncCompletionItemSource which filters and sorts available CompletionItems given the current state of the editor.
[Export(typeof(IAsyncCompletionItemSource))] [Name(nameof(MyCompletionItemSource))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] public class MyCompletionItemSource : IAsyncCompletionItemSource
This is a MEF component and should be exported with [ContentType] and [Name] attributes and optional [TextViewRoles] attribute. Completion feature will request data from all exported IAsyncCompletionItemSources whose ContentType matches content type of any buffer in the completion's trigger location.
Creates an instance of IAsyncCompletionItemSource for the specified ITextView.
Instance of IAsyncCompletionItemSource
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | Text view that will host the completion. Completion acts on buffers of this view. |
Microsoft.VisualStudio.Language.Intellisense
Represents a class that filters and sorts available CompletionItems given the current state of the editor. It also declares which completion filters are available for the returned subset of CompletionItems.
Instances of this class should be created by IAsyncCompletionItemSourceProvider, which is a MEF part.
SortCompletionListAsync(initialList,snapshot,triggerReason,filterReason,applicableToSpan,availableFilters,token) method
# =
This method is first called before completion is about to appear, and then on subsequent typing events and when user toggles completion filters. user's input tracked with ITrackingSpan on given ITextSnapshot and a collection of CompletionFilterWithStates that indicate user's filter selection.
Instance of FilteredCompletionModel that contains completion items to render, filters to display and recommended item to select
Name | Type | Description |
---|---|---|
initialList | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionItem} | Set of CompletionItems to filter and sort |
snapshot | Microsoft.VisualStudio.Language.Intellisense.CompletionTriggerReason | Current text snapshot of the view's top buffer |
triggerReason | Microsoft.VisualStudio.Text.ITextSnapshot | The CompletionTriggerReason completion was initially triggered. |
filterReason | Microsoft.VisualStudio.Text.ITrackingSpan | The CompletionFilterReason completion is being sorted. |
applicableToSpan | Microsoft.VisualStudio.Text.Editor.ITextView | Span which tracks the location of the completion session and user's input |
availableFilters | System.Threading.CancellationToken | Filters, their availability and selection state |
UpdateCompletionListAsync(sortedList,snapshot,triggerReason,filterReason,applicableToSpan,availableFilters,token) method
# =
This method is first called before completion is about to appear, and then on subsequent typing events and when user toggles completion filters. user's input tracked with ITrackingSpan on given ITextSnapshot and a collection of CompletionFilterWithStates that indicate user's filter selection.
Instance of FilteredCompletionModel that contains completion items to render, filters to display and recommended item to select
Name | Type | Description |
---|---|---|
sortedList | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionItem} | Set of CompletionItems to filter and sort |
snapshot | Microsoft.VisualStudio.Language.Intellisense.CompletionTriggerReason | Current text snapshot of the view's top buffer |
triggerReason | Microsoft.VisualStudio.Language.Intellisense.CompletionFilterReason | The CompletionTriggerReason completion was initially triggered. |
filterReason | Microsoft.VisualStudio.Text.ITextSnapshot | The CompletionFilterReason completion is being updated. |
applicableToSpan | Microsoft.VisualStudio.Text.ITrackingSpan | Span which tracks the location of the completion session and user's input |
availableFilters | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.CompletionFilterWithState} | Filters, their availability and selection state |
token | Microsoft.VisualStudio.Text.Editor.ITextView | Cancellation token that may interrupt this operation |
Microsoft.VisualStudio.Language.Intellisense
Provides instances of IAsyncCompletionService which filters and sorts available CompletionItems given the current state of the editor.
[Export(typeof(IAsyncCompletionService))] [Name(nameof(MyCompletionService))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = "OtherCompletionService")] public class MyCompletionServiceProvider : IAsyncCompletionServiceProvider
This is a MEF component and should be exported with [ContentType] and [Name] attributes and optional [Order] and [TextViewRoles] attributes. An instance of IAsyncCompletionService is selected first by matching ContentType with content type of the view's top buffer, and then by Order. Only one IAsyncCompletionService is used in a given view.
Creates an instance of IAsyncCompletionService for the specified ITextView.
Instance of IAsyncCompletionService
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | Text view that will host the completion. Completion acts on buffers of this view. |
Microsoft.VisualStudio.Language.Intellisense
Represents a class that tracks completion within a single ITextView. Constructed and managed by an instance of IAsyncCompletionBroker
Returns the ITextView this session is active on.
Commits the currently selected CompletionItem. Runs on UI thread.
Name | Type | Description |
---|---|---|
token | System.Threading.CancellationToken | Token used to cancel this operation |
char | System.Char | The text edit which caused this action. May be default(char). |
Commits the single CompletionItem or opens the completion UI.
Name | Type | Description |
---|---|---|
token | System.Threading.CancellationToken | Token used to cancel this operation |
Stops the session and hides associated UI.
This method has no parameters.
Gets currently selected item
This method has no parameters.
Gets items visible in the UI
This method has no parameters.
Request completion to be opened or updated in a given location, completion items filtered and sorted, and the UI updated.
Name | Type | Description |
---|---|---|
view | Microsoft.VisualStudio.Text.Editor.ITextView | View that hosts completion and relevant buffers |
trigger | Microsoft.VisualStudio.Language.Intellisense.CompletionTrigger | What caused completion |
applicableSpan | Microsoft.VisualStudio.Text.SnapshotPoint | Span which tracks the location of the completion session and user's input |
Returns whether given text edit should result in committing this session.
Name | Type | Description |
---|---|---|
edit | Microsoft.VisualStudio.Text.Editor.ITextView | The text edit which caused this action. May be null. |
triggerLocation | System.Char | Location on the view's top buffer |
Microsoft.VisualStudio.Language.Intellisense
Controls invocation and dismissal of Quick Info tooltips for ITextView instances.
This type can be called from any thread and will marshal its work to the UI thread as required.
Gets the current IAsyncQuickInfoSession for the ITextView.
The session, or null
if there is no active session.
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | The ITextView for which to lookup the session. |
Quick info is considered to be active if there is a visible, calculating, or recalculating quick info session.
Triggers Quick Info tooltip in the specified ITextView at the caret or optional triggerPoint
.
An IAsyncQuickInfoSession tracking the state of the session or null if there are no items.
Name | Type | Description |
---|---|---|
cancellationToken | Microsoft.VisualStudio.Text.Editor.ITextView | If canceled before the method returns, cancels any computations in progress. |
textView | Microsoft.VisualStudio.Text.ITrackingPoint | The ITextView for which Quick Info is to be triggered. |
triggerPoint | Microsoft.VisualStudio.Language.Intellisense.QuickInfoSessionOptions | The ITrackingPoint in the view's text buffer at which Quick Info should be triggered. |
options | System.Threading.CancellationToken | Options for customizing Quick Info behavior. |
Name | Description |
---|---|
System.OperationCanceledException |
cancellationToken was canceled by the caller or the operation was interrupted by another call to TriggerQuickInfoAsync
|
Microsoft.VisualStudio.Language.Intellisense
Tracks state of a visible or calculating Quick Info session.
The span of text to which this Quick Info session applies.
The ordered, merged collection of content to be displayed in the Quick Info.
This field is originally null and is updated with the content once the session has finished querying the providers.
Indicates that this Quick Info has interactive content that can request to stay open.
Specifies attributes of the Quick Info session and Quick Info session presentation.
The current state of the Quick Info session.
The ITextView for which this Quick Info session was created.
Dismisses the Quick Info session, if applicable. If the session is already dismissed, this method no-ops.
A task tracking the completion of the operation.
This method has no parameters.
Gets the point at which the Quick Info tip was triggered in the ITextView.
A ITrackingPoint indicating the point over which Quick Info was invoked.
Name | Type | Description |
---|---|---|
textBuffer | Microsoft.VisualStudio.Text.ITextBuffer | The ITextBuffer relative to which to obtain the point. |
Returned ITrackingPoint is on the buffer requested by the caller.
Gets the point at which the Quick Info tip was triggered in the ITextView.
The point over which Quick Info was invoked or null
if it does not exist in snapshot
.
Name | Type | Description |
---|---|---|
snapshot | Microsoft.VisualStudio.Text.ITextSnapshot | The ITextSnapshot relative to which to obtain the point. |
Returned point is on the buffer requested by the caller.
Microsoft.VisualStudio.Language.Intellisense
Source of Quick Info tooltip content item, proffered to the IDE by a IAsyncQuickInfoSourceProvider.
This class is always constructed and disposed on the UI thread and called on a non-UI thread. Callers that require the UI thread must explicitly marshal there with SwitchToMainThreadAsync. Content objects are resolved into UI constructs via the IViewElementFactoryService.
Gets Quick Info item and tracking span via a QuickInfoItem.
item and a tracking span for which these item are applicable.
Name | Type | Description |
---|---|---|
session | Microsoft.VisualStudio.Language.Intellisense.IAsyncQuickInfoSession | An object tracking the current state of the Quick Info. |
cancellationToken | System.Threading.CancellationToken | Cancels an in-progress computation. |
This method is always called on a background thread. Multiple elements can be be returned by a single source by wrapping them in a ContainerElement.
Microsoft.VisualStudio.Language.Intellisense
A MEF component part that is proffered to the IDE to construct an IAsyncQuickInfoSource.
[Export(typeof(IAsyncQuickInfoSourceProvider))] [Name("Foo QuickInfo Provider")] [Order(After = "default")] [ContentType("text")]
This class is always constructed and called on the UI thread.
Creates an IAsyncQuickInfoSource for the specified ITextBuffer.
An instance of IAsyncQuickInfoSource for textBuffer
or null if no source could be created.
Name | Type | Description |
---|---|---|
textBuffer | Microsoft.VisualStudio.Text.ITextBuffer | The ITextBuffer for which this source produces items. |
Microsoft.VisualStudio.Language.Intellisense
Represents a class that manages user interface for the completion feature
Instances of this class should be created by ICompletionPresenterProvider, which is a MEF part.
Hides the completion UI
This method has no parameters.
Opens the UI and displays provided data
Name | Type | Description |
---|---|---|
presentation | Microsoft.VisualStudio.Language.Intellisense.CompletionPresentationViewModel |
Displays provided data on the UI
Name | Type | Description |
---|---|---|
presentation | Microsoft.VisualStudio.Language.Intellisense.CompletionPresentationViewModel |
Microsoft.VisualStudio.Language.Intellisense
Represents a class that produces instances of ICompletionPresenter
[Export(typeof(ICompletionUIFactory))] [Name(nameof(MyCompletionUIFactory))] [ContentType("any")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = nameof(MyOtherCompletionUIFactory))] public class MyCompletionUIFactory : ICompletionUIFactory
This is a MEF component and should be exported with [ContentType] and [Name] attributes and optional [Order] attribute. An instance of ICompletionPresenterProvider is selected first by matching ContentType with content type of the view's top buffer, and then by Order. Only one ICompletionPresenterProvider is used in a given view.
Declares size of the jump when user presses PageUp and PageDown keys.
This value is read by the controller that processes scrolling and selection. The ICompletionPresenter is just a view that doesn't participate in keyboard scrolling.
Returns instance of ICompletionPresenter that will host completion for given ITextView
Instance of ICompletionPresenter
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | Text view that will host the completion. Completion acts on buffers of this view. |
It is encouraged to reuse the UI over creating new UI each time this method is called.
Microsoft.VisualStudio.Language.Intellisense
Represents an interactive Quick Info content. This interface can be used to add an interactive content such as hyperlinks to the Quick Info popup. If any object implementing this interface is provided to IAsyncQuickInfoSource via GetQuickInfoItemAsync, the Quick Info presenter will allow to interact with this content, particulartly it will keep Quick Info popup open when mouse is over it and will allow this content to recieve mouse events.
Gets a value indicating whether the mouse pointer is located over this interactive Quick Info content, including any parts that are out of the Quick Info visual tree (such as popups).
Gets whether the interactive Quick Info content wants to keep current Quick Info session open. Until this property is true, the IAsyncQuickInfoSession containing this content won't be dismissed even if mouse is moved somewhere else. This is useful in very rare scenarios when an interactive Quick Info content handles all input interaction, while needs to keep this IAsyncQuickInfoSession open (the only known example so far is LightBulb in its expanded state hosted in Quick Info).
Microsoft.Internal.VisualStudio.Language.Intellisense
This interface supports the product infrastructure and should not be used.
This method supports the product infrastructure and should not be used.
This method has no parameters.
Microsoft.Internal.VisualStudio.Language.Intellisense
This interface supports the product infrastructure and should not be used.
Microsoft.Internal.VisualStudio.Language.Intellisense
This interface supports the product infrastructure and should not be used.
This interface supports the product infrastructure and should not be used.
This method has no parameters.
Microsoft.Internal.VisualStudio.Language.Intellisense
This interface supports the product infrastructure and should not be used.
This interface supports the product infrastructure and should not be used.
Microsoft.VisualStudio.Language.Intellisense
The result generated by an IAsyncQuickInfoSource.
Constructs a new instance of QuickInfoItem.
Name | Type | Description |
---|---|---|
applicableToSpan | Microsoft.VisualStudio.Text.ITrackingSpan | The span to which item is applicable. |
item | System.Object | The Quick Info item. |
Name | Description |
---|---|
System.ArgumentNullException | Thrown if item is null. |
The ITrackingSpan to which Item is applicable.
This parameter can be null.
The item to be displayed in the Quick Info IToolTipPresenter.
Microsoft.VisualStudio.Language.Intellisense
Options for customization of Quick Info behavior.
No options.
Dismisses Quick Info when the mouse moves away.
Microsoft.VisualStudio.Language.Intellisense
Defines the possible IAsyncQuickInfoSession states.
Session is currently computing Quick Info content.
Session has been created but is not yet active.
Session has been dismissed and is no longer active.
Computation is complete and session is visible.
Microsoft.VisualStudio.Language.Intellisense
Creates a new instance of QuickInfoSessionStateChangedEventArgs.
Name | Type | Description |
---|---|---|
oldState | Microsoft.VisualStudio.Language.Intellisense.QuickInfoSessionState | The state before the transition. |
newState | Microsoft.VisualStudio.Language.Intellisense.QuickInfoSessionState | The state after the transition. |
The state after the transition.
The state before the transition.