-
Notifications
You must be signed in to change notification settings - Fork 32
Modern completion API
Contents #
- CommitBehavior
- CommitResult
- CompletionClosedEventArgs
- CompletionContext
- CompletionFilter
- CompletionFilterChangedEventArgs
- CompletionFilterReason
- CompletionFilterWithState
-
CompletionItem
- #ctor(displayText,source,icon,suffix)
- #ctor(displayText,source,icon,filters)
- #ctor(displayText,source,icon,filters,suffix)
- #ctor(displayText,source,icon,filters,suffix,insertText,sortText,filterText,attributeIcons)
- #ctor(displayText,source)
- #ctor(displayText,source,icon,suffix)
- #ctor(displayText,source,icon,filters)
- #ctor(displayText,source,icon,filters,suffix)
- #ctor(displayText,source,icon,filters,suffix,insertText,sortText,filterText,attributeIcons)
- AttributeIcons
- DisplayText
- Filters
- FilterText
- Icon
- InsertText
- Properties
- SortText
- Source
- Suffix
- CompletionItemEventArgs
- CompletionItemSelectedEventArgs
- CompletionItemSelection
- CompletionItemsWithHighlightEventArgs
- CompletionItemWithHighlight
- CompletionPresentationViewModel
- CompletionTrigger
- CompletionTriggeredEventArgs
- CompletionTriggerReason
- DetailsTemplateNameAttribute
- FilteredCompletionModel
- IAsyncCodeLensDataPoint
- IAsyncCodeLensDataPointProvider
- IAsyncCompletionBroker
- IAsyncCompletionCommitManager
- IAsyncCompletionCommitManagerProvider
- IAsyncCompletionItemManager
- IAsyncCompletionItemManagerProvider
- IAsyncCompletionSession
- IAsyncCompletionSource
- IAsyncCompletionSourceProvider
- ICompletionPresenter
- ICompletionPresenterProvider
- InitialSelectionOption
- PredefinedCompletionNames
- SessionInitialData
- SessionInstantenousData
- SuggestionItemOptions
- UpdateTrigger
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Instructs the editor how to behave after invoking the custom commit method.
Use the default behavior
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.
Surpresses further invocation of the TypeChar command handlers. By default, editor invoke these command handlers to enable features such as brace completion.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Tracks whether the commit occured, and provides instructions for behavior after committing.
Creates a CommitResult with specified properties.
Name | Type | Description |
---|---|---|
isHandled | System.Boolean | Whether the commit occured |
behavior | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CommitBehavior | Desired behavior after committing |
Marks this commit as handled. No other IAsyncCompletionCommitManager will be asked to commit.
Marks this commit as unhandled. Another IAsyncCompletionCommitManager will be asked to commit.
Desired behavior after committing, respected even when IsHandled is unset.
Whether the commit occured. If true, no other IAsyncCompletionCommitManager will be asked to commit. If false, another IAsyncCompletionCommitManager will be asked to commit.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class is used to notify completion's logic when the UI closes
Constructs instance of CompletionClosedEventArgs.
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | ITextView that hosted this completion UI |
ITextView that hosted completion UI
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This type is used to transfer data from IAsyncCompletionSource to IAsyncCompletionBroker and further to IAsyncCompletionItemManager
Constructs CompletionContext with specified CompletionItems. Completion will use default selection and no suggestion mode, unless overriden by another IAsyncCompletionSource
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem} | Available completion items |
Constructs CompletionContext with CompletionItems with specified suggestion mode and soft selection properties.
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. |
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.
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 |
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.
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 |
Empty completion context, when IAsyncCompletionSource offers no items pertinent to given location.
Set of completion items available at a location
When set, uses suggestion mode with options specified in this object. When null, this context does not provide a suggestion mode item.
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.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Identifies a filter that toggles exclusive display of CompletionItems that reference it.
static CompletionFilter MyFilter = new CompletionFilter("My items", "m", MyItemsImageMoniker);
These instances should be singletons. All CompletionItems that should be filtered using the same filter button must use the same reference to the instance of CompletionFilter.
Constructs an instance of CompletionFilter.
Name | Type | Description |
---|---|---|
displayText | System.String | Name of this filter |
accessKey | System.String | Key used in a keyboard shortcut that toggles this filter. |
image | Microsoft.VisualStudio.Text.Adornments.ImageElement | Image that represents this filter |
Key used in a keyboard shortcut that toggles this filter.
Name of this filter.
ImageElement that represents this filter.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class is used to notify completion's logic of selection change in the filter UI
Constructs instance of CompletionFilterChangedEventArgs.
Name | Type | Description |
---|---|---|
filters | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilterWithState} | Current state of the filters |
Current state of the filters
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Describes the kind of action that triggered completion to filter.
Completion was triggered via an action deleting a character from the document.
Update was triggered by changing filters
Completion was triggered by a direct invocation of the completion feature using the Edit.ListMember command.
Completion was triggered via an action inserting a character into the document.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Immutable data transfer object used to communicate between the completion session and completion UI
Constructs a new instance of CompletionFilterWithState.
Name | Type | Description |
---|---|---|
filter | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter | Reference to CompletionFilter |
isAvailable | System.Boolean | Whether this CompletionFilter is available |
Constructs a new instance of CompletionFilterWithState when selected state is known.
Name | Type | Description |
---|---|---|
filter | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilter | Reference to CompletionFilter |
isAvailable | System.Boolean | Whether this CompletionFilter is available |
isSelected | System.Boolean | Whether this CompletionFilter is selected |
Reference to the completion filter
Whether the filter is available. Filter should be available when there are visible CompletionItems that define this Filter in their Filters
Whether the filter is selected by the user.
Override for nice debugger display
This method has no parameters.
Returns instance of CompletionFilterWithState with specified IsAvailable
Updated instance of CompletionFilterWithState
Name | Type | Description |
---|---|---|
isAvailable | System.Boolean | Value to use for IsAvailable |
Returns instance of CompletionFilterWithState with specified IsSelected
Updated instance of CompletionFilterWithState
Name | Type | Description |
---|---|---|
availability | System.Boolean | Value to use for IsSelected |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class, returned from IAsyncCompletionSource, represents a single entry to be displayed in the completion UI. This class implements IPropertyOwner
Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, and there are no filter, suffix nor attribute images associated with this item.
Name | Type | Description |
---|---|---|
displayText | System.String | Text to use in the UI, when sorting, filtering and completing |
source | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSource | Reference to IAsyncCompletionSource that created this item |
icon | Microsoft.VisualStudio.Core.Imaging.AccessibleImageId | Image displayed in the UI |
Creates a completion item whose DisplayText, InsertText, SortText and FilterText are all the same, there is an image, filters, and there are no suffix nor attribute images associated with this item.
Name | Type | Description |
---|---|---|
displayText | System.String | Text to use in the UI, when sorting, filtering and completing |
source | Microsoft.VisualStudio.Language.Intellisense.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 |
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.
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
# =
Creates a completion item, allowing customization of all of its properties.
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 |
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.
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 |
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.
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 |
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.
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 |
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.
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
# =
Creates a completion item, allowing customization of all of its properties.
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 |
Additional images to display in the UI. Usually, these images are displayed on the far right side of the UI.
Text used in the UI
ImmutableArray of references to CompletionFilters applicable to this item
Text used by IAsyncCompletionItemManager when matching against the applicable span
Image displayed in the UI
Text inserted when completing this item
The collection of properties controlled by the property owner. See Properties
Text used by IAsyncCompletionItemManager when sorting against other items
Reference to the instance that will provide tooltip and custom commit method. Usually it is the same instance as the one that created this CompletionItem
Additional text to display in the UI, after DisplayText. This text has less emphasis than DisplayText and is usually right-aligned.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class is used to notify of an operation that affects a single CompletionItem.
Constructs instance of CompletionItemEventArgs.
This constructor has no parameters.
Relevant item
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class is used to notify completion's logic of selecting through the UI
Constructs instance of CompletionItemSelectedEventArgs.
Name | Type | Description |
---|---|---|
selectedItem | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem | User-selected item |
suggestionModeSelected | System.Boolean | Whether the selected item is a suggestion mode item |
Selected item. Might be null if there is no selection
Whether selected item is a suggestion mode item
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Don't change the current selection mode.
Set selection mode to regular selection: item is committed using Tab, mouse, enter and commit characters.
Set selection mode to soft selection: item is committed only using Tab or mouse.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class is used to notify of an operation that affects multiple CompletionItemWithHighlights.
Constructs instance of CompletionItemEventArgs.
This constructor has no parameters.
Relevant items
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Wraps CompletionItem with information about highlighted parts of its DisplayText.
Constructs CompletionItemWithHighlight without any highlighting. Used when the CompletionItem appears in the completion list without being a text match.
Name | Type | Description |
---|---|---|
completionItem | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem | Instance of the CompletionItem |
Constructs CompletionItemWithHighlight with given highlighting. Used when text used to filter the completion list can be found in the DisplayText.
Name | Type | Description |
---|---|---|
completionItem | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem | Instance of the CompletionItem |
highlightedSpans | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Text.Span} | Spans of DisplayText to highlight |
The completion item
Which parts of DisplayText to highlight
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class contains completion items, filters and other pieces of information used by ICompletionPresenter to render the completion UI.
#ctor(items,filters,applicableSpan,useSoftSelection,useSuggestionMode,selectSuggestionMode,selectedItemIndex,suggestionModeItem) constructor
# =
Constructs CompletionPresentationViewModel
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.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 |
Span pertinent to the completion session.
Completion filters with their available and selected state.
Completion items to display with their highlighted spans.
Controls which item is selected. Use -1 in suggestion mode.
Controls whether suggestion mode item is selected.
How to display the suggestion mode completion.
Suggestion mode item to display.
Controls whether selected item should be soft selected.
Controls whether suggestion mode item is visible.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
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.
Creates a CompletionTrigger associated with a text edit
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 |
Creates a CompletionTrigger not associated with a text edit
Name | Type | Description |
---|---|---|
reason | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionTriggerReason | The kind of action that triggered completion to start |
The text edit associated with the triggering action.
The reason that completion was started.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class is used to notify about new IAsyncCompletionSession being triggered
Constructs instance of CompletionItemSelectedEventArgs.
Name | Type | Description |
---|---|---|
completionSession | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.IAsyncCompletionSession | Newly created IAsyncCompletionSession |
textView | Microsoft.VisualStudio.Text.Editor.ITextView | ITextView where completion was triggered |
Newly created IAsyncCompletionSession.
ITextView where completion was triggered.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Describes the kind of action that initially triggered completion to open.
Completion was triggered via an action deleting a character from the document.
Completion was triggered via an action inserting a character into the document.
Completion was triggered by a direct invocation of the completion feature using the Edit.ListMember command.
Completion was triggered with a request to commit if a single item would be selected using the Edit.CompleteWord command.
Completion was triggered for snippets only.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
This class, returned from IAsyncCompletionItemManager, contains completion items to display in the UI, recommended item to display, selection mode and available filters.
Constructs FilteredCompletionModel without completion filters.
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItemWithHighlight} | Items to display in the completion UI. |
selectedItemIndex | System.Int32 | Recommended item index to select. |
Constructs FilteredCompletionModel with completion filters.
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.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. |
Constructs FilteredCompletionModel with completion filters, indication regarding selection mode and the unique item
Name | Type | Description |
---|---|---|
items | System.Collections.Immutable.ImmutableArray{Microsoft.VisualStudio.Language.Intellisense.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. |
Whether selected item should be displayed in the center of the list. Usually, this is true
Completion filters with their availability and selection state.
Items to display in the completion UI.
Recommended item index to select. Presence of a suggestion mode item may override
Controls the selection mode of the selected item.
Optionally, provides an item that should be committed using the "commit if unique" command.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Represents a class that manages the completion feature. The editor uses this class to trigger completion and obtain instance of IAsyncCompletionSession which contains methods and events relevant to the active completion session.
[Import] IAsyncCompletionBroker CompletionBroker { get; set; }
Returns IAsyncCompletionSession if active or null if not
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | View that hosts completion and relevant buffers |
Returns whether completion is active in given view
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | View that hosts completion and relevant buffers |
Returns whether there are any completion item sources available for the top buffer in the provided view.
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Utilities.IContentType | View to check for available completion source exports |
Activates completion and returns IAsyncCompletionSession. If completion was already active, returns the existing session without changing it. Must be invoked on UI thread.
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 |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Represents a class that provides means to commit CompletionItems and other information relevant to the completion feature at a specific SnapshotPoint.
Instances of this class should be created by IAsyncCompletionCommitManagerProvider, which is a MEF part.
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.
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.
True if this character should commit the active session.
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. |
Requests commit of specified CompletionItem. Called on UI thread.
Instruction for the editor how to proceed after invoking this method
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 |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Provides instances of IAsyncCompletionItemManager which filters and sorts available CompletionItems given the current state of the editor.
[Export(typeof(IAsyncCompletionCommitManagerProvider))] [Name(nameof(MyCompletionCommitManagerProvider))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = "OtherCompletionCommitManager")] public class MyCompletionCommitManagerProvider : IAsyncCompletionCommitManagerProvider
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.
Creates an instance of IAsyncCompletionCommitManager for the specified ITextView.
Instance of IAsyncCompletionItemManager
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | Text view that will host the completion. Completion acts on buffers of this view. |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
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.
Instances of this class should be created by IAsyncCompletionItemManagerProvider, which is a MEF part.
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
Instance of FilteredCompletionModel that contains completion items to render, filters to display and recommended item to select
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 |
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.
Instance of FilteredCompletionModel that contains completion items to render, filters to display and recommended item to select
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 |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Provides instances of IAsyncCompletionItemManager which filters and sorts available CompletionItems given the current state of the editor.
[Export(typeof(IAsyncCompletionItemManagerProvider))] [Name(nameof(MyCompletionItemManagerProvider))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = "OtherCompletionItemManager")] public class MyCompletionItemManagerProvider : IAsyncCompletionItemManagerProvider
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.
Creates an instance of IAsyncCompletionItemManager for the specified ITextView.
Instance of IAsyncCompletionItemManager
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | Text view that will host the completion. Completion acts on buffers of this view. |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Represents a class that tracks completion within a single ITextView. Constructed and managed by an instance of IAsyncCompletionBroker
Gets span applicable to this completion session. The span is defined on the session's TextBuffer.
Returns whether session is dismissed. When session is dismissed, all work is canceled.
Returns the ITextView this session is active on.
Commits the currently selected CompletionItem. Must be called on UI thread.
Instruction for the editor how to proceed after invoking this method
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 |
Commits the single CompletionItem or opens the completion UI. Must be called on UI thread.
Whether the unique item was committed.
Name | Type | Description |
---|---|---|
token | System.Threading.CancellationToken | Token used to cancel this operation |
Stops the session and hides associated UI. May be called from any thread.
This method has no parameters.
Gets suggestion items visible in the UI. This is a blocking call. As a side effect, prevents the UI from displaying.
This method has no parameters.
Gets items visible in the UI. This is a blocking call. As a side effect, prevents the UI from displaying.
This method has no parameters.
Gets currently selected item. This is a blocking call. As a side effect, prevents the UI from displaying.
This method has no parameters.
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.
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. |
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.
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 |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Represents a class that provides CompletionItems and other information relevant to the completion feature at a specific SnapshotPoint.
Instances of this class should be created by IAsyncCompletionSourceProvider, which is a MEF part.
Called once per completion session to fetch the set of all completion items available at a given location. Called on a background thread.
A struct that holds completion items and applicable span
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 |
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.
Return type is pending what we agree to describe GUI in cross platform fashion
Name | Type | Description |
---|---|---|
item | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionItem |
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.
Whether completion should use the supplied applicable span.
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. |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Provides instances of IAsyncCompletionSource which filters and sorts available CompletionItems given the current state of the editor.
[Export(typeof(IAsyncCompletionSourceProvider))] [Name(nameof(MyCompletionSource))] [ContentType("text")] [TextViewRoles(PredefinedTextViewRoles.Editable)] public class MyCompletionSource : IAsyncCompletionSource
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.
Creates an instance of IAsyncCompletionSource for the specified ITextView. Called on the UI thread.
Instance of IAsyncCompletionSource
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | Text view that will host the completion. Completion acts on buffers of this view. |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Represents a class that manages user interface for the completion feature. All methods are called on UI thread.
Instances of this class should be created by ICompletionPresenterProvider, which is a MEF part.
Hides the completion UI
This method has no parameters.
Opens the UI and displays provided data
Name | Type | Description |
---|---|---|
presentation | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionPresentationViewModel |
Displays provided data on the UI
Name | Type | Description |
---|---|---|
presentation | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionPresentationViewModel |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Represents a class that produces instances of ICompletionPresenter
[Export(typeof(ICompletionPresenterProvider))] [Name(nameof(MyCompletionPresenterProvider))] [ContentType("any")] [TextViewRoles(PredefinedTextViewRoles.Editable)] [Order(Before = KnownCompletionNames.DefaultCompletionPresenter)] public class MyCompletionPresenterProvider : ICompletionPresenterProvider
This is a MEF component and should be exported with [ContentType] and [Name] attributes and optional [Order] attribute. An instance of ICompletionPresenterProvider is selected first by matching ContentType with content type of the view's top buffer, and then by Order. Only one ICompletionPresenterProvider is used in a given view.
Declares size of the jump when user presses PageUp and PageDown keys.
This value 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
Returns instance of ICompletionPresenter that will host completion for given ITextView
Instance of ICompletionPresenter
Name | Type | Description |
---|---|---|
textView | Microsoft.VisualStudio.Text.Editor.ITextView | Text view that will host the completion. Completion acts on buffers of this view. |
It is encouraged to reuse the UI over creating new UI each time this method is called.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
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.
Item is selected. It will be committed by pressing a commit character, e.g. a token delimeter, Tab, Enter and mouse click.
Item is soft selected. It will be committed only by pressing Tab or clicking the item.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Provides names used by the Async Completion feature.
Name of the completion's ICommandHandler. Use to order your MEF part.
Name of the default IAsyncCompletionItemManagerProvider. Use to order your MEF part.
Name of the default ICompletionPresenterProvider. Use to order your MEF part.
Name of the editor option that stores user's preference for the completion mode.
Name of the editor option that stores user's preference for the completion mode during debugging.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data
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.
Constructs SessionInitialData
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 |
Set of CompletionItems to sort.
The InitialTrigger that started this completion session.
The ITextSnapshot applicable for this computation. The snapshot comes from the view's top buffer.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data
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
# =
Constructs SessionInstantenousData
Set of CompletionItems to filter and sort, originally returned from SortCompletionListAsync.
The InitialTrigger that started this completion session.
Inidicates whether the session is using soft selection
Inidicates whether completion is in special mode where it is invisible.
Filters, their availability and selection state.
The ITextSnapshot applicable for this computation. The snapshot comes from the view's top buffer.
The UpdateTrigger for this update.
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
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.
Creates instance of SuggestionModeOptions with specified text. Provide this instance to CompletionContext to activate suggestion mode.
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 |
Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
What triggered updating of completion.
Creates a UpdateTrigger associated with a text edit
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 |
Creates a CompletionTrigger not associated with a text edit
Name | Type | Description |
---|---|---|
reason | Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.CompletionFilterReason | The kind of action that triggered completion to update |
The text edit associated with the triggering action.
The reason that completion was updated.