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

Modern completion API

Amadeusz Wieczorek edited this page Feb 27, 2018 · 5 revisions

Doc comments for 15.7.80-preview-g8bc2e9da81 #

Microsoft.VisualStudio.Language # =

CompletionClosedEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

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

CompletionContext # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

This type is used to transfer data from IAsyncCompletionItemSource to IAsyncCompletionBroker and further to IAsyncCompletionService

#ctor(items,applicableSpan) constructor # =

Summary

Constructs CompletionContext with CompletionItem applicable to a SnapshotSpan

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

Summary

Constructs CompletionContext with CompletionItem applicable to a SnapshotSpan, CompletionFilter available for these items and instructions on suggestion mode and soft selection.

Parameters
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

ApplicableToSpan constants # =

Summary

Location pertinent to the completion items

Items constants # =

Summary

Set of completion items available at a location

SuggestionModeDescription constants # =

Summary

Displayed when UI is in suggestion mode, yet there is no code to suggest

UseSoftSelection constants # =

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.

UseSuggestionMode constants # =

Summary

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.

CompletionFilter # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

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.Language.Intellisense.AccessibleImageId ImageId 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

AccessibleImageId that represents this filter.

CompletionFilterChangedEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

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.CompletionFilterWithState} Current state of the filters

Filters property # =

Summary

Current state of the filters

CompletionFilterReason # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

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

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.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.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.

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

Summary

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

#ctor(displayText,source) constructor # =

Summary

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.

Parameters
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

#ctor(displayText,source,image,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, attribute images, suffix nor custom commit behavior 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.IAsyncCompletionItemSource Reference to IAsyncCompletionItemSource that created this item
image Microsoft.VisualStudio.Language.Intellisense.AccessibleImageId Image displayed in the UI

#ctor(displayText,source,image,suffix) 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, attribute images nor custom commit behavior 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.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,source,image,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 custom commit behavior 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.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,source,image,suffix) constructor # =

Summary

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.

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

Summary

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

Parameters
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

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 IAsyncCompletionService when matching against the applicable span

Image 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 IAsyncCompletionService 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.

UseCustomCommit property # =

Summary

Whether or not to invoke item's Source's custom commit method when completing this item

CompletionItemEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

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

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.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

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

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

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.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.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

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.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

ApplicableSpan constants # =

Summary

Span pertinent to the completion session.

Filters constants # =

Summary

Completion filters with their available and selected state.

Items constants # =

Summary

Completion items to display with their highlighted spans.

SelectedItemIndex constants # =

Summary

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

SelectSuggestionMode constants # =

Summary

Controls whether suggestion mode item is selected.

SuggestionModeDescription constants # =

Summary

Text to display when SuggestionModeItem's InsertText is empty.

SuggestionModeItem constants # =

Summary

Suggestion mode item to display.

UseSoftSelection constants # =

Summary

Controls whether selected item should be soft selected.

UseSuggestionMode constants # =

Summary

Controls whether suggestion mode item is visible.

CompletionTrigger # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

What triggered the completion (but not where it happened)

#ctor(reason,character) constructor # =

Summary

Creates a CompletionTrigger associated with a text edit

Parameters
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

#ctor(reason) constructor # =

Summary

Creates a CompletionTrigger not associated with a text edit

Parameters
Name Type Description
reason Microsoft.VisualStudio.Language.Intellisense.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.

CompletionTriggerReason # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

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

Summary

This class, returned from IAsyncCompletionService, 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.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.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.

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

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

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(view) method # =

Summary

Returns IAsyncCompletionSession if active or null if not

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

IsCompletionActive(view) method # =

Summary

Returns whether completion is active in given view

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

IsCompletionSupported(view) method # =

Summary

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

Parameters
Name Type Description
view Microsoft.VisualStudio.Text.Editor.ITextView View to check for available completion source exports

ShouldTriggerCompletion(view,typeChar,triggerLocation) method # =

Summary

Returns whether completion should trigger as a result of the text edit.

Returns

True if completion should trigger

Parameters
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

TriggerCompletion(view,triggerLocation) method # =

Summary

Activates completion and returns IAsyncCompletionSession. If completion was already active, returns the existing session without changing it.

Parameters
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

IAsyncCompletionItemSource # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

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 IAsyncCompletionItemSourceProvider, which is a MEF part.

CustomCommit(view,buffer,item,applicableSpan,edit) method # =

Summary

Custom commit behavior for completion item created by this completion item source. Called if UseCustomCommit is set.

Returns
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.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

GetCompletionContextAsync(trigger,triggerLocation) method # =

Summary

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

Returns

A struct that holds completion items and applicable span

Parameters
Name Type Description
trigger Microsoft.VisualStudio.Language.Intellisense.CompletionTrigger What caused the completion
triggerLocation Microsoft.VisualStudio.Text.SnapshotPoint Where completion was triggered

GetDescriptionAsync(item) method # =

Summary

Returns tooltip associated with provided completion item

Returns

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

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

GetPotentialCommitCharacters() method # =

Summary

Returns characters that may commit completion. When text edit matches one of these characters, ShouldCommitCompletion is called.

Parameters

This method has no parameters.

HandleViewClosedAsync(view) method # =

Summary

Fired when a view, previously involved in completion, closes

Parameters
Name Type Description
view Microsoft.VisualStudio.Text.Editor.ITextView View that closes

ShouldCommitCompletion(typeChar,location) method # =

Summary

Returns whether this character is a commit character in a given location.

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

ShouldTriggerCompletion(typeChar,location) method # =

Summary

Returns whether this character is a trigger character in a given context

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

IAsyncCompletionItemSourceProvider # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

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

Example

[Export(typeof(IAsyncCompletionItemSource))] [Name(nameof(MyCompletionItemSource))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] public class MyCompletionItemSource : IAsyncCompletionItemSource

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

GetOrCreate(textView) method # =

Summary

Creates an instance of IAsyncCompletionItemSource for the specified ITextView.

Returns

Instance of IAsyncCompletionItemSource

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

IAsyncCompletionService # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

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.

Remarks

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

SortCompletionListAsync(initialList,snapshot,triggerReason,filterReason,applicableToSpan,availableFilters,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. user's input tracked with ITrackingSpan on given ITextSnapshot and a collection of CompletionFilterWithStates 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
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 # =

Summary

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.

Returns

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

Parameters
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

IAsyncCompletionServiceProvider # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

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

Example

[Export(typeof(IAsyncCompletionService))] [Name(nameof(MyCompletionService))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = "OtherCompletionService")] public class MyCompletionServiceProvider : IAsyncCompletionServiceProvider

Remarks

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.

GetOrCreate(textView) method # =

Summary

Creates an instance of IAsyncCompletionService for the specified ITextView.

Returns

Instance of IAsyncCompletionService

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

Summary

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

TextView property # =

Summary

Returns the ITextView this session is active on.

Commit(token,char) method # =

Summary

Commits the currently selected CompletionItem. Runs on UI thread.

Parameters
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).

CommitIfUnique(token) method # =

Summary

Commits the single CompletionItem or opens the completion UI.

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

Dismiss() method # =

Summary

Stops the session and hides associated UI.

Returns
Parameters

This method has no parameters.

GetSelectedItem() method # =

Summary

Gets currently selected item

Parameters

This method has no parameters.

GetVisibleItems() method # =

Summary

Gets items visible in the UI

Parameters

This method has no parameters.

OpenOrUpdate(view,trigger,applicableSpan,triggerLocation) method # =

Summary

Request completion to be opened or updated in a given location, completion items filtered and sorted, and the UI updated.

Parameters
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

ShouldCommit(edit,triggerLocation) method # =

Summary

Returns whether given text edit should result in committing this session.

Returns
Parameters
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

IAsyncQuickInfoBroker # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

Controls invocation and dismissal of Quick Info tooltips for ITextView instances.

Remarks

This type can be called from any thread and will marshal its work to the UI thread as required.

GetSession(textView) method # =

Summary

Gets the current IAsyncQuickInfoSession for the ITextView.

Returns

The session, or null if there is no active session.

Parameters
Name Type Description
textView Microsoft.VisualStudio.Text.Editor.ITextView The ITextView for which to lookup the session.
Remarks

Quick info is considered to be active if there is a visible, calculating, or recalculating quick info session.

TriggerQuickInfoAsync(cancellationToken,textView,triggerPoint,options) method # =

Summary

Triggers Quick Info tooltip in the specified ITextView at the caret or optional triggerPoint.

Returns

An IAsyncQuickInfoSession tracking the state of the session or null if there are no items.

Parameters
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.
Exceptions
Name Description
System.OperationCanceledException cancellationToken was canceled by the caller or the operation was interrupted by another call to TriggerQuickInfoAsync

IAsyncQuickInfoSession # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

Tracks state of a visible or calculating Quick Info session.

ApplicableToSpan property # =

Summary

The span of text to which this Quick Info session applies.

Content property # =

Summary

The ordered, merged collection of content to be displayed in the Quick Info.

Remarks

This field is originally null and is updated with the content once the session has finished querying the providers.

HasInteractiveContent property # =

Summary

Indicates that this Quick Info has interactive content that can request to stay open.

Options property # =

Summary

Specifies attributes of the Quick Info session and Quick Info session presentation.

State property # =

Summary

The current state of the Quick Info session.

TextView property # =

Summary

The ITextView for which this Quick Info session was created.

DismissAsync() method # =

Summary

Dismisses the Quick Info session, if applicable. If the session is already dismissed, this method no-ops.

Returns

A task tracking the completion of the operation.

Parameters

This method has no parameters.

GetTriggerPoint(textBuffer) method # =

Summary

Gets the point at which the Quick Info tip was triggered in the ITextView.

Returns

A ITrackingPoint indicating the point over which Quick Info was invoked.

Parameters
Name Type Description
textBuffer Microsoft.VisualStudio.Text.ITextBuffer The ITextBuffer relative to which to obtain the point.
Remarks

Returned ITrackingPoint is on the buffer requested by the caller.

GetTriggerPoint(snapshot) method # =

Summary

Gets the point at which the Quick Info tip was triggered in the ITextView.

Returns

The point over which Quick Info was invoked or null if it does not exist in snapshot.

Parameters
Name Type Description
snapshot Microsoft.VisualStudio.Text.ITextSnapshot The ITextSnapshot relative to which to obtain the point.
Remarks

Returned point is on the buffer requested by the caller.

IAsyncQuickInfoSource # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

Source of Quick Info tooltip content item, proffered to the IDE by a IAsyncQuickInfoSourceProvider.

Remarks

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.

GetQuickInfoItemAsync(session,cancellationToken) method # =

Summary

Gets Quick Info item and tracking span via a QuickInfoItem.

Returns

item and a tracking span for which these item are applicable.

Parameters
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.
Remarks

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.

IAsyncQuickInfoSourceProvider # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

A MEF component part that is proffered to the IDE to construct an IAsyncQuickInfoSource.

Example

[Export(typeof(IAsyncQuickInfoSourceProvider))] [Name("Foo QuickInfo Provider")] [Order(After = "default")] [ContentType("text")]

Remarks

This class is always constructed and called on the UI thread.

TryCreateQuickInfoSource(textBuffer) method # =

Summary

Creates an IAsyncQuickInfoSource for the specified ITextBuffer.

Returns

An instance of IAsyncQuickInfoSource for textBuffer or null if no source could be created.

Parameters
Name Type Description
textBuffer Microsoft.VisualStudio.Text.ITextBuffer The ITextBuffer for which this source produces items.

ICompletionPresenter # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

Represents a class that manages user interface for the completion feature

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.CompletionPresentationViewModel

Update(presentation) method # =

Summary

Displays provided data on the UI

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

ICompletionPresenterProvider # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

Represents a class that produces instances of ICompletionPresenter

Example

[Export(typeof(ICompletionUIFactory))] [Name(nameof(MyCompletionUIFactory))] [ContentType("any")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = nameof(MyOtherCompletionUIFactory))] public class MyCompletionUIFactory : ICompletionUIFactory

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 is read by the controller that processes scrolling and selection. The 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.

IInteractiveQuickInfoContent # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

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.

IsMouseOverAggregated property # =

Summary

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).

KeepQuickInfoOpen property # =

Summary

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).

ILegacyQuickInfoBrokerSupport # =

Namespace

Microsoft.Internal.VisualStudio.Language.Intellisense

Summary

This interface supports the product infrastructure and should not be used.

TriggerQuickInfoAsync() method # =

Summary

This method supports the product infrastructure and should not be used.

Parameters

This method has no parameters.

ILegacyQuickInfoMetadata # =

Namespace

Microsoft.Internal.VisualStudio.Language.Intellisense

Summary

This interface supports the product infrastructure and should not be used.

ILegacyQuickInfoSource # =

Namespace

Microsoft.Internal.VisualStudio.Language.Intellisense

Summary

This interface supports the product infrastructure and should not be used.

AugmentQuickInfoSession() method # =

Summary

This interface supports the product infrastructure and should not be used.

Parameters

This method has no parameters.

ILegacyQuickInfoSourcesSupport # =

Namespace

Microsoft.Internal.VisualStudio.Language.Intellisense

Summary

This interface supports the product infrastructure and should not be used.

LegacySources property # =

Summary

This interface supports the product infrastructure and should not be used.

QuickInfoItem # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

The result generated by an IAsyncQuickInfoSource.

#ctor(applicableToSpan,item) constructor # =

Summary

Constructs a new instance of QuickInfoItem.

Parameters
Name Type Description
applicableToSpan Microsoft.VisualStudio.Text.ITrackingSpan The span to which item is applicable.
item System.Object The Quick Info item.
Exceptions
Name Description
System.ArgumentNullException Thrown if item is null.

ApplicableToSpan property # =

Summary

The ITrackingSpan to which Item is applicable.

Remarks

This parameter can be null.

Item property # =

Summary

The item to be displayed in the Quick Info IToolTipPresenter.

QuickInfoSessionOptions # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

Options for customization of Quick Info behavior.

None constants # =

Summary

No options.

TrackMouse constants # =

Summary

Dismisses Quick Info when the mouse moves away.

QuickInfoSessionState # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

Defines the possible IAsyncQuickInfoSession states.

Calculating constants # =

Summary

Session is currently computing Quick Info content.

Created constants # =

Summary

Session has been created but is not yet active.

Dismissed constants # =

Summary

Session has been dismissed and is no longer active.

Visible constants # =

Summary

Computation is complete and session is visible.

QuickInfoSessionStateChangedEventArgs # =

Namespace

Microsoft.VisualStudio.Language.Intellisense

Summary

Arguments for the event.

#ctor(oldState,newState) constructor # =

Summary

Creates a new instance of QuickInfoSessionStateChangedEventArgs.

Parameters
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.

NewState property # =

Summary

The state after the transition.

OldState property # =

Summary

The state before the transition.

Clone this wiki locally