Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Modern completion API

Amadeusz Wieczorek edited this page May 9, 2018 · 5 revisions

Contents #

Microsoft.VisualStudio.Language # =

CommitBehavior # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Instructs the editor how to behave after invoking the custom commit method.

None constants # =

Summary

Use the default behavior

RaiseFurtherCommandHandlers constants # =

Summary

Raises further invocation of the ReturnKey and Tab command handlers. By default, editor doesn't invoke ReturnKey and Tab command handlers after committing completion session.

SuppressFurtherCommandHandlers constants # =

Summary

Surpresses further invocation of the TypeChar command handlers. By default, editor invoke these command handlers to enable features such as brace completion.

CommitResult # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Tracks whether the commit occured, and provides instructions for behavior after committing.

#ctor(isHandled,behavior) constructor # =

Summary

Creates a CommitResult with specified properties.

Parameters
Name Type Description
isHandled System.Boolean Whether the commit occured
behavior Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CommitBehavior Desired behavior after committing

Handled constants # =

Summary

Marks this commit as handled. No other IAsyncCompletionCommitManager will be asked to commit.

Unhandled constants # =

Summary

Marks this commit as unhandled. Another IAsyncCompletionCommitManager will be asked to commit.

Behavior property # =

Summary

Desired behavior after committing, respected even when IsHandled is unset.

IsHandled property # =

Summary

Whether the commit occured. If true, no other IAsyncCompletionCommitManager will be asked to commit. If false, another IAsyncCompletionCommitManager will be asked to commit.

CompletionClosedEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This class is used to notify completion's logic when the UI closes

#ctor(textView) constructor # =

Summary

Constructs instance of CompletionClosedEventArgs.

Parameters
Name Type Description
textView Microsoft.VisualStudio.Text.Editor.ITextView ITextView that hosted this completion UI

TextView property # =

Summary

ITextView that hosted completion UI

CompletionContext # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This type is used to transfer data from IAsyncCompletionSource to IAsyncCompletionBroker and further to IAsyncCompletionItemManager

#ctor(items) constructor # =

Summary

Constructs CompletionContext with specified CompletionItems. Completion will use default selection and no suggestion mode, unless overriden by another IAsyncCompletionSource

Parameters
Name Type Description
items System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem} Available completion items

#ctor(items,useSoftSelection,useSuggestionMode,suggestionModeDescription) constructor # =

Summary

Constructs CompletionContext with CompletionItems with specified suggestion mode and soft selection properties.

Parameters
Name Type Description
items System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem} Available completion items
useSoftSelection System.Boolean Whether UI should use soft selection
useSuggestionMode System.Boolean Whether UI should enter suggestion mode
suggestionModeDescription System.String Explains why suggestion mode is active. It is displayed when applicableSpan is empty. Otherwise, UI displays content of applicableSpan. May be null.

#ctor(items,useSoftSelection,suggestionModeOptions) constructor # =

Summary

Construsts CompletionContext with specified CompletionItems. Completion will use specified selection mode, and if SuggestionModeOptions is not null, it will use suggestion mode with specified options.

Parameters
Name Type Description
items System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem} Available completion items
useSoftSelection System.Boolean Whether UI should use soft selection. Default is false. Usually it is true when suggestionModeOptions is set
suggestionModeOptions Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.SuggestionItemOptions Whether there should be completion item

#ctor(items,useSoftSelection,suggestionModeOptions) constructor # =

Summary

Construsts CompletionContext with specified CompletionItems. Completion will use specified selection mode, and if SuggestionModeOptions is not null, it will use suggestion mode with specified options.

Parameters
Name Type Description
items System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem} Available completion items
useSoftSelection Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.InitialSelectionOption Whether UI should use soft selection. Default is false. Usually it is true when suggestionModeOptions is set
suggestionModeOptions Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.SuggestionItemOptions Whether there should be completion item

Default constants # =

Summary

Empty completion context, when IAsyncCompletionSource offers no items pertinent to given location.

Items property # =

Summary

Set of completion items available at a location

SuggestionModeOptions property # =

Summary

When set, uses suggestion mode with options specified in this object. When null, this context does not provide a suggestion mode item.

UseSoftSelection property # =

Summary

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.

CompletionFilter # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Identifies a filter that toggles exclusive display of CompletionItems that reference it.

Example

static CompletionFilter MyFilter = new CompletionFilter("My items", "m", MyItemsImageMoniker);

Remarks

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.

#ctor(displayText,accessKey,image) constructor # =

Summary

Constructs an instance of CompletionFilter.

Parameters
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.Text.Adornments.ImageElement Image that represents this filter

AccessKey property # =

Summary

Key used in a keyboard shortcut that toggles this filter.

DisplayText property # =

Summary

Name of this filter.

Image property # =

Summary

ImageElement that represents this filter.

CompletionFilterChangedEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This class is used to notify completion's logic of selection change in the filter UI

#ctor(filters) constructor # =

Summary

Constructs instance of CompletionFilterChangedEventArgs.

Parameters
Name Type Description
filters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilterWithState} Current state of the filters

Filters property # =

Summary

Current state of the filters

CompletionFilterReason # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Describes the kind of action that triggered completion to filter.

Deletion constants # =

Summary

Completion was triggered via an action deleting a character from the document.

FilterChange constants # =

Summary

Update was triggered by changing filters

Initial constants # =

Summary

Completion was triggered by a direct invocation of the completion feature using the Edit.ListMember command.

Insertion constants # =

Summary

Completion was triggered via an action inserting a character into the document.

CompletionFilterWithState # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Immutable data transfer object used to communicate between the completion session and completion UI

#ctor(filter,isAvailable) constructor # =

Summary

Constructs a new instance of CompletionFilterWithState.

Parameters
Name Type Description
filter Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter Reference to CompletionFilter
isAvailable System.Boolean Whether this CompletionFilter is available

#ctor(filter,isAvailable,isSelected) constructor # =

Summary

Constructs a new instance of CompletionFilterWithState when selected state is known.

Parameters
Name Type Description
filter Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter Reference to CompletionFilter
isAvailable System.Boolean Whether this CompletionFilter is available
isSelected System.Boolean Whether this CompletionFilter is selected

Filter property # =

Summary

Reference to the completion filter

IsAvailable property # =

Summary

Whether the filter is available. Filter should be available when there are visible CompletionItems that define this Filter in their Filters

IsSelected property # =

Summary

Whether the filter is selected by the user.

ToString() method # =

Summary

Override for nice debugger display

Parameters

This method has no parameters.

WithAvailability(isAvailable) method # =

Summary

Returns instance of CompletionFilterWithState with specified IsAvailable

Returns

Updated instance of CompletionFilterWithState

Parameters
Name Type Description
isAvailable System.Boolean Value to use for IsAvailable

WithSelected(availability) method # =

Summary

Returns instance of CompletionFilterWithState with specified IsSelected

Returns

Updated instance of CompletionFilterWithState

Parameters
Name Type Description
availability System.Boolean Value to use for IsSelected

CompletionItem # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This class, returned from IAsyncCompletionSource, represents a single entry to be displayed in the completion UI. This class implements IPropertyOwner

#ctor(displayText,source,icon,suffix) constructor # =

Summary

Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, and there are no filter, suffix nor attribute images associated with this item.

Parameters
Name Type Description
displayText System.String Text to use in the UI, when sorting, filtering and completing
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item
icon Microsoft.VisualStudio.Core.Imaging.AccessibleImageId Image displayed in the UI

#ctor(displayText,source,icon,filters) constructor # =

Summary

Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, filters, and there are no suffix nor attribute images associated with this item.

Parameters
Name Type Description
displayText System.String Text to use in the UI, when sorting, filtering and completing
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item
icon Microsoft.VisualStudio.Core.Imaging.AccessibleImageId Image displayed in the UI
filters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter} ImmutableArray of references to CompletionFilters applicable to this item

#ctor(displayText,source,icon,filters,suffix) constructor # =

Summary

Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, filters, suffix, and there are no attribute images associated with this item.

Parameters
Name Type Description
displayText System.String Text to use in the UI, when sorting, filtering and completing
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item
icon Microsoft.VisualStudio.Core.Imaging.AccessibleImageId Image displayed in the UI
filters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter} ImmutableArray of references to CompletionFilters applicable to this item
suffix System.String Additional text to display in the UI

#ctor(displayText,source,icon,filters,suffix,insertText,sortText,filterText,attributeIcons) constructor # =

Summary

Creates a completion item, allowing customization of all of its properties.

Parameters
Name Type Description
displayText System.String Text used in the UI
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item
icon Microsoft.VisualStudio.Core.Imaging.AccessibleImageId Image displayed in the UI
filters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter} ImmutableArray of references to CompletionFilters applicable to this item
suffix System.String Additional text to display in the UI
insertText System.String Text inserted when completing this item
sortText System.String Text used by IAsyncCompletionItemManager when sorting against other items
filterText System.String Text used by IAsyncCompletionItemManager when matching against the applicable span
attributeIcons System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Core.Imaging.AccessibleImageId} Additional images to display in the UI

#ctor(displayText,source) constructor # =

Summary

Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, and there are no icon, filter, suffix nor attribute icons associated with this item.

Parameters
Name Type Description
displayText System.String Text to use in the UI, when sorting, filtering and completing
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item

#ctor(displayText,source,icon,suffix) constructor # =

Summary

Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, and there are no filter, suffix nor attribute images associated with this item.

Parameters
Name Type Description
displayText System.String Text to use in the UI, when sorting, filtering and completing
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item
icon Microsoft.VisualStudio.Text.Adornments.ImageElement Image displayed in the UI

#ctor(displayText,source,icon,filters) constructor # =

Summary

Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, filters, and there are no suffix nor attribute images associated with this item.

Parameters
Name Type Description
displayText System.String Text to use in the UI, when sorting, filtering and completing
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item
icon Microsoft.VisualStudio.Text.Adornments.ImageElement Image displayed in the UI
filters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter} ImmutableArray of references to CompletionFilters applicable to this item

#ctor(displayText,source,icon,filters,suffix) constructor # =

Summary

Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, filters, suffix, and there are no attribute images associated with this item.

Parameters
Name Type Description
displayText System.String Text to use in the UI, when sorting, filtering and completing
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item
icon Microsoft.VisualStudio.Text.Adornments.ImageElement Image displayed in the UI
filters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter} ImmutableArray of references to CompletionFilters applicable to this item
suffix System.String Additional text to display in the UI

#ctor(displayText,source,icon,filters,suffix,insertText,sortText,filterText,attributeIcons) constructor # =

Summary

Creates a completion item, allowing customization of all of its properties.

Parameters
Name Type Description
displayText System.String Text used in the UI
source Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource Reference to IAsyncCompletionSource that created this item
icon Microsoft.VisualStudio.Text.Adornments.ImageElement Image displayed in the UI
filters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter} ImmutableArray of references to CompletionFilters applicable to this item
suffix System.String Additional text to display in the UI
insertText System.String Text inserted when completing this item
sortText System.String Text used by IAsyncCompletionItemManager when sorting against other items
filterText System.String Text used by IAsyncCompletionItemManager when matching against the applicable span
attributeIcons System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Text.Adornments.ImageElement} Additional images to display in the UI

AttributeIcons property # =

Summary

Additional images to display in the UI. Usually, these images are displayed on the far right side of the UI.

DisplayText property # =

Summary

Text used in the UI

Filters property # =

Summary

ImmutableArray of references to CompletionFilters applicable to this item

FilterText property # =

Summary

Text used by IAsyncCompletionItemManager when matching against the applicable span

Icon property # =

Summary

Image displayed in the UI

InsertText property # =

Summary

Text inserted when completing this item

Properties property # =

Summary

The collection of properties controlled by the property owner. See Properties

SortText property # =

Summary

Text used by IAsyncCompletionItemManager when sorting against other items

Source property # =

Summary

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

Suffix property # =

Summary

Additional text to display in the UI, after DisplayText. This text has less emphasis than DisplayText and is usually right-aligned.

CompletionItemEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This class is used to notify of an operation that affects a single CompletionItem.

#ctor() constructor # =

Summary

Constructs instance of CompletionItemEventArgs.

Parameters

This constructor has no parameters.

Item property # =

Summary

Relevant item

CompletionItemSelectedEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This class is used to notify completion's logic of selecting through the UI

#ctor(selectedItem,suggestionModeSelected) constructor # =

Summary

Constructs instance of CompletionItemSelectedEventArgs.

Parameters
Name Type Description
selectedItem Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem User-selected item
suggestionModeSelected System.Boolean Whether the selected item is a suggestion mode item

SelectedItem property # =

Summary

Selected item. Might be null if there is no selection

SuggestionModeSelected property # =

Summary

Whether selected item is a suggestion mode item

CompletionItemSelection # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

NoChange constants # =

Summary

Don't change the current selection mode.

Selected constants # =

Summary

Set selection mode to regular selection: item is committed using Tab, mouse, enter and commit characters.

SoftSelected constants # =

Summary

Set selection mode to soft selection: item is committed only using Tab or mouse.

CompletionItemsWithHighlightEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This class is used to notify of an operation that affects multiple CompletionItemWithHighlights.

#ctor() constructor # =

Summary

Constructs instance of CompletionItemEventArgs.

Parameters

This constructor has no parameters.

Items property # =

Summary

Relevant items

CompletionItemWithHighlight # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Wraps CompletionItem with information about highlighted parts of its DisplayText.

#ctor(completionItem) constructor # =

Summary

Constructs CompletionItemWithHighlight without any highlighting. Used when the CompletionItem appears in the completion list without being a text match.

Parameters
Name Type Description
completionItem Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem Instance of the CompletionItem

#ctor(completionItem,highlightedSpans) constructor # =

Summary

Constructs CompletionItemWithHighlight with given highlighting. Used when text used to filter the completion list can be found in the DisplayText.

Parameters
Name Type Description
completionItem Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem Instance of the CompletionItem
highlightedSpans System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Text.Span} Spans of DisplayText to highlight

CompletionItem property # =

Summary

The completion item

HighlightedSpans property # =

Summary

Which parts of DisplayText to highlight

CompletionPresentationViewModel # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

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 # =

Summary

Constructs CompletionPresentationViewModel

Parameters
Name Type Description
items System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItemWithHighlight} Completion items to display with their highlighted spans
filters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.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.AsyncCompletion.CompletionItem Suggestion mode item to display

ApplicableSpan property # =

Summary

Span pertinent to the completion session.

Filters property # =

Summary

Completion filters with their available and selected state.

Items property # =

Summary

Completion items to display with their highlighted spans.

SelectedItemIndex property # =

Summary

Controls which item is selected. Use -1 in suggestion mode.

SelectSuggestionMode property # =

Summary

Controls whether suggestion mode item is selected.

SuggestionItemOptions property # =

Summary

How to display the suggestion mode completion.

SuggestionModeItem property # =

Summary

Suggestion mode item to display.

UseSoftSelection property # =

Summary

Controls whether selected item should be soft selected.

UseSuggestionMode property # =

Summary

Controls whether suggestion mode item is visible.

CompletionTrigger # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

What triggered the completion, but not where it happened. The reason we don't expose location is that for each extension, we map the point to a buffer with matching content type.

#ctor(reason,character) constructor # =

Summary

Creates a CompletionTrigger associated with a text edit

Parameters
Name Type Description
reason Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionTriggerReason The kind of action that triggered completion to start
character System.Char Character that triggered completion

#ctor(reason) constructor # =

Summary

Creates a CompletionTrigger not associated with a text edit

Parameters
Name Type Description
reason Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionTriggerReason The kind of action that triggered completion to start

Character property # =

Summary

The text edit associated with the triggering action.

Reason property # =

Summary

The reason that completion was started.

CompletionTriggeredEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This class is used to notify about new IAsyncCompletionSession being triggered

#ctor(completionSession,textView) constructor # =

Summary

Constructs instance of CompletionItemSelectedEventArgs.

Parameters
Name Type Description
completionSession Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSession Newly created IAsyncCompletionSession
textView Microsoft.VisualStudio.Text.Editor.ITextView ITextView where completion was triggered

CompletionSession property # =

Summary

Newly created IAsyncCompletionSession.

TextView property # =

Summary

ITextView where completion was triggered.

CompletionTriggerReason # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Describes the kind of action that initially triggered completion to open.

Deletion constants # =

Summary

Completion was triggered via an action deleting a character from the document.

Insertion constants # =

Summary

Completion was triggered via an action inserting a character into the document.

Invoke constants # =

Summary

Completion was triggered by a direct invocation of the completion feature using the Edit.ListMember command.

InvokeAndCommitIfUnique constants # =

Summary

Completion was triggered with a request to commit if a single item would be selected using the Edit.CompleteWord command.

Snippets constants # =

Summary

Completion was triggered for snippets only.

FilteredCompletionModel # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

This class, returned from IAsyncCompletionItemManager, contains completion items to display in the UI, recommended item to display, selection mode and available filters.

#ctor(items,selectedItemIndex) constructor # =

Summary

Constructs FilteredCompletionModel without completion filters.

Parameters
Name Type Description
items System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItemWithHighlight} Items to display in the completion UI.
selectedItemIndex System.Int32 Recommended item index to select.

#ctor(items,selectedItemIndex,filters) constructor # =

Summary

Constructs FilteredCompletionModel with completion filters.

Parameters
Name Type Description
items System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.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.AsyncCompletion.CompletionFilterWithState} Completion filters with their availability and selection state.

#ctor(items,selectedItemIndex,filters,selectionMode,uniqueItem) constructor # =

Summary

Constructs FilteredCompletionModel with completion filters, indication regarding selection mode and the unique item

Parameters
Name Type Description
items System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.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.AsyncCompletion.CompletionFilterWithState} Completion filters with their availability and selection state.
selectionMode Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItemSelection Allows IAsyncCompletionItemManager to influence the selection mode.
uniqueItem System.Boolean Provides CompletionItem to commit using "commit if unique" command despite displaying more than one item.

CenterSelection property # =

Summary

Whether selected item should be displayed in the center of the list. Usually, this is true

Filters property # =

Summary

Completion filters with their availability and selection state.

Items property # =

Summary

Items to display in the completion UI.

SelectedItemIndex property # =

Summary

Recommended item index to select. Presence of a suggestion mode item may override

SelectionMode property # =

Summary

Controls the selection mode of the selected item.

UniqueItem property # =

Summary

Optionally, provides an item that should be committed using the "commit if unique" command.

IAsyncCompletionBroker # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

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.

Example

[Import] IAsyncCompletionBroker CompletionBroker { get; set; }

GetSession(textView) method # =

Summary

Returns IAsyncCompletionSession if active or null if not

Parameters
Name Type Description
textView Microsoft.VisualStudio.Text.Editor.ITextView View that hosts completion and relevant buffers

IsCompletionActive(textView) method # =

Summary

Returns whether completion is active in given view

Parameters
Name Type Description
textView Microsoft.VisualStudio.Text.Editor.ITextView View that hosts completion and relevant buffers

IsCompletionSupported(textView) method # =

Summary

Returns whether there are any completion item sources available for the top buffer in the provided view.

Parameters
Name Type Description
textView Microsoft.VisualStudio.Utilities.IContentType View to check for available completion source exports

TriggerCompletion(textView,triggerLocation,typeChar) method # =

Summary

Activates completion and returns IAsyncCompletionSession. If completion was already active, returns the existing session without changing it. Must be invoked on UI thread.

Parameters
Name Type Description
textView 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 IAsyncCompletionSources and IAsyncCompletionItemManager
typeChar System.Char Character that triggered completion, or default

IAsyncCompletionCommitManager # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Represents a class that provides means to commit CompletionItems and other information relevant to the completion feature at a specific SnapshotPoint.

Remarks

Instances of this class should be created by IAsyncCompletionCommitManagerProvider, which is a MEF part.

PotentialCommitCharacters property # =

Summary

Returns characters that may commit completion. When completion is active and a text edit matches one of these characters, ShouldCommitCompletion is called to verify that the character is indeed a commit character at a given location. Called on UI thread.

ShouldCommitCompletion(typeChar,location) method # =

Summary

Returns whether this character is a commit character in a given location. If every character returned by PotentialCommitCharacters should always commit the active completion session, return true. Called on UI thread.

Returns

True if this character should commit the active session.

Parameters
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. The character is not inserted into this snapshot.

TryCommit(view,buffer,item,applicableSpan,typedChar,token) method # =

Summary

Requests commit of specified CompletionItem. Called on UI thread.

Returns

Instruction for the editor how to proceed after invoking this method

Parameters
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.AsyncCompletion.CompletionItem Which completion item is to be applied
applicableSpan Microsoft.VisualStudio.Text.ITrackingSpan Span augmented by completion, on the view's top buffer
typedChar System.Char Text change associated with this commit
token System.Threading.CancellationToken Cancellation token

IAsyncCompletionCommitManagerProvider # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Provides instances of IAsyncCompletionItemManager which filters and sorts available CompletionItems given the current state of the editor.

Example

[Export(typeof(IAsyncCompletionCommitManagerProvider))] [Name(nameof(MyCompletionCommitManagerProvider))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = "OtherCompletionCommitManager")] public class MyCompletionCommitManagerProvider : IAsyncCompletionCommitManagerProvider

Remarks

This is a MEF component and should be exported with [ContentType] and [Name] attributes and optional [Order] and [TextViewRoles] attributes. An instance of IAsyncCompletionItemManager is selected first by matching ContentType with content type of the view's top buffer, and then by Order. Only one IAsyncCompletionItemManager is used in a given view.

GetOrCreate(textView) method # =

Summary

Creates an instance of IAsyncCompletionCommitManager for the specified ITextView.

Returns

Instance of IAsyncCompletionItemManager

Parameters
Name Type Description
textView Microsoft.VisualStudio.Text.Editor.ITextView Text view that will host the completion. Completion acts on buffers of this view.

IAsyncCompletionItemManager # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

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. All methods are called on background thread.

Remarks

Instances of this class should be created by IAsyncCompletionItemManagerProvider, which is a MEF part.

SortCompletionListAsync(session,data,token) method # =

Summary

This method is first called before completion is about to appear, and then on subsequent typing events and when user toggles completion filters. The result of this method will be used in subsequent invocations of UpdateCompletionListAsyncsession tracks user user's input tracked with ApplicableSpan. data provides applicable Snapshot and

Returns

Instance of FilteredCompletionModel that contains completion items to render, filters to display and recommended item to select

Parameters
Name Type Description
session Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSession The active IAsyncCompletionSession. See ApplicableSpan and TextView
data Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.SessionInitialData Contains properties applicable at the time this method is invoked.
token System.Threading.CancellationToken Cancellation token that may interrupt this operation

UpdateCompletionListAsync(session,data,token) method # =

Summary

This method is first called before completion is about to appear, and then on subsequent typing events and when user toggles completion filters. session tracks user user's input tracked with ApplicableSpan. data provides applicable Snapshot and and SelectedFilterss that indicate user's filter selection.

Returns

Instance of FilteredCompletionModel that contains completion items to render, filters to display and recommended item to select

Parameters
Name Type Description
session Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSession The active IAsyncCompletionSession. See ApplicableSpan and TextView
data Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.SessionInstantenousData Contains properties applicable at the time this method is invoked.
token System.Threading.CancellationToken Cancellation token that may interrupt this operation

IAsyncCompletionItemManagerProvider # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Provides instances of IAsyncCompletionItemManager which filters and sorts available CompletionItems given the current state of the editor.

Example

[Export(typeof(IAsyncCompletionItemManagerProvider))] [Name(nameof(MyCompletionItemManagerProvider))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = "OtherCompletionItemManager")] public class MyCompletionItemManagerProvider : IAsyncCompletionItemManagerProvider

Remarks

This is a MEF component and should be exported with [ContentType] and [Name] attributes and optional [Order] and [TextViewRoles] attributes. An instance of IAsyncCompletionItemManager is selected first by matching ContentType with content type of the view's top buffer, and then by Order. Only one IAsyncCompletionItemManager is used in a given view.

GetOrCreate(textView) method # =

Summary

Creates an instance of IAsyncCompletionItemManager for the specified ITextView.

Returns

Instance of IAsyncCompletionItemManager

Parameters
Name Type Description
textView Microsoft.VisualStudio.Text.Editor.ITextView Text view that will host the completion. Completion acts on buffers of this view.

IAsyncCompletionSession # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Represents a class that tracks completion within a single ITextView. Constructed and managed by an instance of IAsyncCompletionBroker

ApplicableSpan property # =

Summary

Gets span applicable to this completion session. The span is defined on the session's TextBuffer.

IsDismissed property # =

Summary

Returns whether session is dismissed. When session is dismissed, all work is canceled.

TextView property # =

Summary

Returns the ITextView this session is active on.

Commit(typedChar,token) method # =

Summary

Commits the currently selected CompletionItem. Must be called on UI thread.

Returns

Instruction for the editor how to proceed after invoking this method

Parameters
Name Type Description
typedChar System.Char The text edit which caused this action. May be default(char).
token System.Threading.CancellationToken Token used to cancel this operation

CommitIfUnique(token) method # =

Summary

Commits the single CompletionItem or opens the completion UI. Must be called on UI thread.

Returns

Whether the unique item was committed.

Parameters
Name Type Description
token System.Threading.CancellationToken Token used to cancel this operation

Dismiss() method # =

Summary

Stops the session and hides associated UI. May be called from any thread.

Parameters

This method has no parameters.

GetBuilderItems() method # =

Summary

Gets suggestion items visible in the UI. This is a blocking call. As a side effect, prevents the UI from displaying.

Parameters

This method has no parameters.

GetItems() method # =

Summary

Gets items visible in the UI. This is a blocking call. As a side effect, prevents the UI from displaying.

Parameters

This method has no parameters.

GetSelectedItem() method # =

Summary

Gets currently selected item. This is a blocking call. As a side effect, prevents the UI from displaying.

Parameters

This method has no parameters.

OpenOrUpdate(trigger,triggerLocation,token) method # =

Summary

Request completion to be opened or updated in a given location, the completion items to be filtered and sorted, and the UI updated. Must be called on UI thread. Enqueues work on a worker thread.

Parameters
Name Type Description
trigger Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionTrigger What caused completion
triggerLocation Microsoft.VisualStudio.Text.SnapshotPoint Location of the trigger on the subject buffer
token System.Threading.CancellationToken Token used to cancel this and other queued operation.

ShouldCommit(typedChar,triggerLocation,token) method # =

Summary

Returns whether given text edit should result in committing this session. Since this method is on a typing hot path, it uses PotentialCommitCharacters to quickly return if typedChar is not a potential commit character. Else, we map triggerLocation to subject buffers and query ShouldCommitCompletion. Must be called on UI thread.

Returns
Parameters
Name Type Description
typedChar System.Char The text edit which caused this action. May be null.
triggerLocation Microsoft.VisualStudio.Text.SnapshotPoint Location on the view's top buffer
token System.Threading.CancellationToken Token used to cancel this operation

IAsyncCompletionSource # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Represents a class that provides CompletionItems and other information relevant to the completion feature at a specific SnapshotPoint.

Remarks

Instances of this class should be created by IAsyncCompletionSourceProvider, which is a MEF part.

GetCompletionContextAsync(trigger,triggerLocation,applicableSpan) method # =

Summary

Called once per completion session to fetch the set of all completion items available at a given location. Called on a background thread.

Returns

A struct that holds completion items and applicable span

Parameters
Name Type Description
trigger Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionTrigger What caused the completion
triggerLocation Microsoft.VisualStudio.Text.SnapshotPoint Location where completion was triggered, on the subject buffer that matches this IAsyncCompletionSource's content type
applicableSpan Microsoft.VisualStudio.Text.SnapshotSpan Location where completion will take place, on the view's top buffer

GetDescriptionAsync(item) method # =

Summary

Returns tooltip associated with provided completion item. The returned object will be rendered by IViewElementFactoryService. See its documentation for supported types. Called on a background thread, so UIElement may not be returned.

Returns

Return type is pending what we agree to describe GUI in cross platform fashion

Parameters
Name Type Description
item Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem

TryGetApplicableSpan(typeChar,triggerLocation,applicableSpan) method # =

Summary

Provides the span applicable to the prospective session. Called on UI thread and expected to return very quickly, based on syntactic information. This method is called sequentially on available IAsyncCompletionSources until one of them returns true. Returning false does not exclude this source from participating in completion session. If no IAsyncCompletionSources return true, there will be no completion session.

Returns

Whether completion should use the supplied applicable span.

Parameters
Name Type Description
typeChar System.Char Character typed by the user
triggerLocation Microsoft.VisualStudio.Text.SnapshotPoint Location on the subject buffer that matches this IAsyncCompletionSource's content type
applicableSpan Microsoft.VisualStudio.Text.SnapshotSpan@ Applicable span for the prospective completion session. You may set it to default(SnapshotSpan) if returning false.

IAsyncCompletionSourceProvider # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Provides instances of IAsyncCompletionSource which filters and sorts available CompletionItems given the current state of the editor.

Example

[Export(typeof(IAsyncCompletionSourceProvider))] [Name(nameof(MyCompletionSource))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] public class MyCompletionSource : IAsyncCompletionSource

Remarks

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 IAsyncCompletionSources whose ContentType matches content type of any buffer in the completion's trigger location.

GetOrCreate(textView) method # =

Summary

Creates an instance of IAsyncCompletionSource for the specified ITextView. Called on the UI thread.

Returns

Instance of IAsyncCompletionSource

Parameters
Name Type Description
textView Microsoft.VisualStudio.Text.Editor.ITextView Text view that will host the completion. Completion acts on buffers of this view.

ICompletionPresenter # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Represents a class that manages user interface for the completion feature. All methods are called on UI thread.

Remarks

Instances of this class should be created by ICompletionPresenterProvider, which is a MEF part.

Close() method # =

Summary

Hides the completion UI

Parameters

This method has no parameters.

Open(presentation) method # =

Summary

Opens the UI and displays provided data

Parameters
Name Type Description
presentation Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionPresentationViewModel

Update(presentation) method # =

Summary

Displays provided data on the UI

Parameters
Name Type Description
presentation Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionPresentationViewModel

ICompletionPresenterProvider # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Represents a class that produces instances of ICompletionPresenter

Example

[Export(typeof(ICompletionPresenterProvider))] [Name(nameof(MyCompletionPresenterProvider))] [ContentType("any")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = KnownCompletionNames.DefaultCompletionPresenter)] public class MyCompletionPresenterProvider : ICompletionPresenterProvider

Remarks

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.

ResultsPerPage property # =

Summary

Declares size of the jump when user presses PageUp and PageDown keys.

Remarks

This value needs to be known before the UI is created, hence it is defined on this class instead of ICompletionPresenter. Note that ICompletionPresenter is just a view that doesn't participate in keyboard scrolling

GetOrCreate(textView) method # =

Summary

Returns instance of ICompletionPresenter that will host completion for given ITextView

Returns

Instance of ICompletionPresenter

Parameters
Name Type Description
textView Microsoft.VisualStudio.Text.Editor.ITextView Text view that will host the completion. Completion acts on buffers of this view.
Remarks

It is encouraged to reuse the UI over creating new UI each time this method is called.

InitialSelectionOption # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

NoSelection constants # =

Summary

There is no selected item. Completion UI will initially not appear. Pressing Tab will dismiss the invisible session. This option is used only in narrow corner cases.

RegularSelection constants # =

Summary

Item is selected. It will be committed by pressing a commit character, e.g. a token delimeter, Tab, Enter and mouse click.

SoftSelection constants # =

Summary

Item is soft selected. It will be committed only by pressing Tab or clicking the item.

PredefinedCompletionNames # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Provides names used by the Async Completion feature.

CompletionCommandHandlers constants # =

Summary

Name of the completion's ICommandHandler. Use to order your MEF part.

DefaultCompletionItemManager constants # =

Summary

Name of the default IAsyncCompletionItemManagerProvider. Use to order your MEF part.

DefaultCompletionPresenter constants # =

Summary

Name of the default ICompletionPresenterProvider. Use to order your MEF part.

SuggestionModeInCompletionOptionName constants # =

Summary

Name of the editor option that stores user's preference for the completion mode.

SuggestionModeInDebuggerCompletionOptionName constants # =

Summary

Name of the editor option that stores user's preference for the completion mode during debugging.

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data

Summary

Contains data of IAsyncCompletionSession valid at a specific, instantenous moment pertinent to current computation. This data is passed to IAsyncCompletionItemManager to initially sort the list prior to filtering and selecting.

#ctor(initialList,snapshot,initialTrigger) constructor # =

Summary

Constructs SessionInitialData

Parameters
Name Type Description
initialList System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionItem} Set of CompletionItems to sort
snapshot Microsoft.VisualStudio.Text.ITextSnapshot The ITextSnapshot applicable for this computation. The snapshot comes from the view's top buffer
initialTrigger Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.InitialTrigger The InitialTrigger that started this completion session

InitialList property # =

Summary

Set of CompletionItems to sort.

InitialTrigger property # =

Summary

The InitialTrigger that started this completion session.

Snapshot property # =

Summary

The ITextSnapshot applicable for this computation. The snapshot comes from the view's top buffer.

SessionInstantenousData # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data

Summary

Contains data of IAsyncCompletionSession valid at a specific, instantenous moment pertinent to current computation. This data is passed to IAsyncCompletionItemManager to filter the list and select appropriate item.

#ctor(initialSortedList,snapshot,initialTrigger,updateTrigger,selectedFilters,isSoftSelected,isUnavailable) constructor # =

Summary

Constructs SessionInstantenousData

Parameters
Name Type Description
initialSortedList System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionItem} Set of CompletionItems to filter and sort, originally returned from SortCompletionListAsync
snapshot Microsoft.VisualStudio.Text.ITextSnapshot The ITextSnapshot applicable for this computation. The snapshot comes from the view's top buffer
initialTrigger Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.InitialTrigger The InitialTrigger that started this completion session
updateTrigger Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.UpdateTrigger The UpdateTrigger for this update
selectedFilters System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data.CompletionFilterWithState} Filters, their availability and selection state
isSoftSelected System.Boolean Inidicates whether the session is using soft selection
isUnavailable System.Boolean Inidicates whether completion is in special mode where it is invisible

InitialSortedList property # =

Summary

Set of CompletionItems to filter and sort, originally returned from SortCompletionListAsync.

InitialTrigger property # =

Summary

The InitialTrigger that started this completion session.

IsSoftSelected property # =

Summary

Inidicates whether the session is using soft selection

IsUnavailable property # =

Summary

Inidicates whether completion is in special mode where it is invisible.

SelectedFilters property # =

Summary

Filters, their availability and selection state.

Snapshot property # =

Summary

The ITextSnapshot applicable for this computation. The snapshot comes from the view's top buffer.

UpdateTrigger property # =

Summary

The UpdateTrigger for this update.

SuggestionItemOptions # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

Instructs the editor if and how to display the suggestion mode completion. Suggestion mode displays a single CompletionItem whose DisplayText and InsertText is equal to text typed by the user so far. This class specifies the tooltip to use for this item, and DisplayText when user has not typed anything.

#ctor(displayTextWhenEmpty,toolTipText) constructor # =

Summary

Creates instance of SuggestionModeOptions with specified text. Provide this instance to CompletionContext to activate suggestion mode.

Parameters
Name Type Description
displayTextWhenEmpty System.String DisplayText for the suggestion item when user has not typed anything
toolTipText System.String Tooltip for the suggestion item

UpdateTrigger # =

Namespace

Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion

Summary

What triggered updating of completion.

#ctor(reason,character) constructor # =

Summary

Creates a UpdateTrigger associated with a text edit

Parameters
Name Type Description
reason Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilterReason The kind of action that triggered completion to update
character System.Char Character that triggered the update

#ctor(reason) constructor # =

Summary

Creates a CompletionTrigger not associated with a text edit

Parameters
Name Type Description
reason Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilterReason The kind of action that triggered completion to update

Character property # =

Summary

The text edit associated with the triggering action.

Reason property # =

Summary

The reason that completion was updated.

Clone this wiki locally