In This Article

ICompletionSession Interface

Provides the base requirements for an object that represents an IntelliPrompt completion session.

public interface ICompletionSession : IIntelliPromptSession, IServiceLocator

Properties

AllowedCharacters

Gets the CharClass containing the non-letter/digit characters allowed to be typed while the completion popup is displayed.

CharClass AllowedCharacters { get; }

Property Value

CharClass:

The CharClass containing the non-letter/digit characters allowed to be typed while the completion popup is displayed.

Remarks

All letter and digit characters are automatically allowed by the completion popup and therefore do not need to added to this property. This property should only contain additional non-letter/digit characters that need to be allowed.

When a character is typed, it's first checked to see if it's a letter, number, or is in the AllowedCharacters collection. If any of those cases is true, the character is entered into the editor and the session remains open. If instead the character is in the CommitCharacters collection and there is a full selection in the completion list, a Commit() occurs. Otherwise, the session is cancelled.

CanCommitWithoutPopup

Gets whether the session can immediately commit if a single match is made when the session is opened, commonly known as "complete word" functionality.

bool CanCommitWithoutPopup { get; }

Property Value

Boolean:

true if the session can immediately commit if a single match is made when the session is opened; otherwise, false. The default value is true.

Remarks

A value of false will force the popup list to always display, even if a single match is made upon open.

CanFilterUnmatchedItems

Gets or sets whether to filter out items that don't match the typed text, thereby shrinking the list of visible items.

bool CanFilterUnmatchedItems { get; }

Property Value

Boolean:

true if items that don't match the typed text should be filtered out, thereby shrinking the list of visible items; otherwise, false. The default value is false.

CanHighlightMatchedText

Gets whether list items show possible matched characters in a highlight color.

bool CanHighlightMatchedText { get; }

Property Value

Boolean:

true if list items show possible matched characters in a highlight color; otherwise, false. The default value is true.

CommitCharacters

Gets or sets the CharClass containing the characters that can be typed when there is a full selection to trigger a Commit().

CharClass CommitCharacters { get; }

Property Value

CharClass:

The CharClass containing the characters that can be typed when there is a full selection to trigger a Commit().

Remarks

The default value of this property is a CharClass that contains all characters.

When a character is typed, it's first checked to see if it's a letter, number, or is in the AllowedCharacters collection. If any of those cases is true, the character is entered into the editor and the session remains open. If instead the character is in the CommitCharacters collection and there is a full selection in the completion list, a Commit() occurs. Otherwise, the session is cancelled.

Context

Gets an object that describes the context in which the completion session is opened.

object Context { get; }

Property Value

Object:

An object that describes the context in which the completion session is opened.

ControlKeyDownOpacity

Gets the opacity of the popup while the control key is pressed.

double ControlKeyDownOpacity { get; }

Property Value

Double:

The opacity of the popup while the control key is pressed. The default value is 0.25.

Remarks

Set the value to 1.0 to prevent opacity changes when the control key is pressed.

DescriptionTipMaxWidth

Gets the description tip popup's maximum width.

double DescriptionTipMaxWidth { get; }

Property Value

Double:

The description tip popup's maximum width, or NaN to indicate no constraint. The default value is 800.

DescriptionTipShowDelay

Gets or sets the TimeSpan to wait after the selection is updated before showing the description tip.

TimeSpan DescriptionTipShowDelay { get; }

Property Value

TimeSpan:

The TimeSpan to wait after the selection is updated before showing the description tip. The default value is 400ms.

FilteredItems

Gets the read-only collection of filtered ICompletionItem objects that are visible within the completion list.

ICompletionItemCollectionView FilteredItems { get; }

Property Value

ICompletionItemCollectionView:

The read-only collection of filtered ICompletionItem objects that are visible within the completion list.

Filters

Gets the collection of ICompletionFilter objects that can be applied to the session.

ICompletionFilterCollection Filters { get; }

Property Value

ICompletionFilterCollection:

The collection of ICompletionFilter objects that can be applied to the session.

IsEnterKeyHandledOnCommit

Gets whether the Enter key is handled (not allowed to insert a line feed) when it commits the session.

bool IsEnterKeyHandledOnCommit { get; }

Property Value

Boolean:

true if the Enter key is handled (not allowed to insert a line feed) when it commits the session; otherwise, false. The default value is true.

ItemMatchers

Gets the collection of ICompletionItemMatcher objects to use when matching items.

ICompletionItemMatcherCollection ItemMatchers { get; }

Property Value

ICompletionItemMatcherCollection:

The collection of ICompletionItemMatcher objects to use when matching items.

Items

Gets the collection of ICompletionItem objects within the completion.

ICompletionItemCollection Items { get; }

Property Value

ICompletionItemCollection:

The collection of ICompletionItem objects within the completion.

MatchOptions

Gets the CompletionMatchOptions indicating the options to use when matching items.

CompletionMatchOptions MatchOptions { get; }

Property Value

CompletionMatchOptions:

The CompletionMatchOptions indicating the options to use when matching items.

RequiresFilterOnTextChange

Gets or sets whether to apply filters when a text change occurs.

bool RequiresFilterOnTextChange { get; set; }

Property Value

Boolean:

true if filters should be applied when a text change occurs; otherwise, false. The default value is false.

Selection

Gets or sets a CompletionSelection indicating the current selection within the completion.

CompletionSelection Selection { get; set; }

Property Value

CompletionSelection:

A CompletionSelection indicating the current selection within the completion.

TypedText

Gets the text that has been used to initialize the session and/or been entered by the end user since the session opened.

string TypedText { get; }

Property Value

String:

The text that has been used to initialize the session and/or been entered by the end user since the session opened.

Methods

ApplyFilters()

Re-applies the active filters and rebuilds the FilteredItems collection.

void ApplyFilters()

Cancel()

Cancels the completion session.

void Cancel()

CloseDescriptionTip()

Closes the description tip if it is open.

void CloseDescriptionTip()

Commit()

Commits the completion session and performs an auto-complete if there is a Selection available.

void Commit()

Open(IEditorView)

Opens the session, attaching to the specified IEditorView.

void Open(IEditorView view)
Parameter Type Description
view IEditorView

The IEditorView in which the session is opened.

RestartDescriptionTipTimer()

Restarts the description tip display timer.

void RestartDescriptionTipTimer()

SortItems()

Sorts the items in the session using the default sort comparer.

void SortItems()

Remarks

Items should always be sorted before the session is opened for an optimal user experience. This method should be called to sort the items right before the session is opened if the items were not pre-sorted.

SortItems(IComparer<ICompletionItem>)

Sorts the items in the session using a custom comparer.

void SortItems(IComparer<ICompletionItem> comparer)
Parameter Type Description
comparer IComparer<ICompletionItem>

The IComparer<T> to use.

Remarks

Items should always be sorted before the session is opened for an optimal user experience. This method should be called to sort the items right before the session is opened if the items were not pre-sorted.

Events

Committed

Occurs after the session is committed.

event EventHandler Committed

Event Type

EventHandler

Committing

Occurs before the session is committed, allowing it to be cancelled.

event EventHandler<CancelEventArgs> Committing

Event Type

EventHandler<CancelEventArgs>

RequestNavigate

Occurs when a hyperlink on a description tip is clicked that requests navigation.

event RequestNavigateEventHandler RequestNavigate

Event Type

RequestNavigateEventHandler

SelectionChanged

Occurs after the Selection has changed.

event EventHandler SelectionChanged

Event Type

EventHandler

Inherited Members

See Also