In This Article

RegexCompletionItemMatcherBase Class

Represents an abstract object that can match completion items based on supplied text using a regular expression.

public abstract class RegexCompletionItemMatcherBase : CompletionItemMatcherBase, ICompletionItemMatcher, IKeyedObject
Inheritance:
object CompletionItemMatcherBase object
Implements:
ICompletionItemMatcher IKeyedObject

Constructors

RegexCompletionItemMatcherBase()

Initializes an instance of the class.

protected RegexCompletionItemMatcherBase()

Methods

GetHighlightedTextRanges(ICompletionSession, ICompletionItem, string)

Returns a collection of TextRange objects that specify the ranges of matched characters within an ICompletionItem's Text.

public override IEnumerable<TextRange> GetHighlightedTextRanges(ICompletionSession session, ICompletionItem item, string text)
Parameter Type Description
session ICompletionSession

The ICompletionSession in which the match is to be made.

item ICompletionItem

The ICompletionItem against which to match.

text string

The text to use for matching.

Returns

IEnumerable<TextRange>:

A collection of TextRange objects that specify the ranges of matched characters within an ICompletionItem's Text.

GetRegex(string, bool)

Returns the Regex to use for matching based on supplied text.

protected abstract Regex GetRegex(string text, bool captureMatches)
Parameter Type Description
text string

The text for which to return a Regex.

captureMatches bool

When true, capturing groups should be included for matches; otherwise false if capturing groups are not necessary.

Returns

Regex:

The Regex that was created.

Match(ICompletionSession, IEnumerable, string, bool)

Attempts to locate an ICompletionItem match based on specified text.

public override CompletionSelection Match(ICompletionSession session, IEnumerable items, string text, bool uniqueFullMatchOnly)
Parameter Type Description
session ICompletionSession

The ICompletionSession in which the match is to be made.

items IEnumerable

The collection of items against which to match.

text string

The text to use for matching.

uniqueFullMatchOnly bool

Whether to only return a match if it is a full and unique match.

Returns

CompletionSelection:

A CompletionSelection instance, if a match was made.

OnTextChanged(string)

Occurs when the text to match changes.

protected virtual void OnTextChanged(string text)
Parameter Type Description
text string

The new text to match.

Inherited Members