New to Telerik UI for WPF? Start a free 30-day trial

Base tagger class for classification of words.

Definition

Namespace:Telerik.Windows.Controls.SyntaxEditor.Tagging.Taggers

Assembly:Telerik.Windows.Controls.SyntaxEditor.dll

Syntax:

C#
public abstract class WordTaggerBase : TaggerBase<ClassificationTag>, ITagger<ClassificationTag>

Inheritance: objectTaggerBase<ClassificationTag>WordTaggerBase

Derived Classes: JavaScriptTaggerSqlTaggerCSharpTaggerVisualBasicTagger

Implements: ITagger<ClassificationTag>

Inherited Members TaggerBase<ClassificationTag>.CallOnTagsChanged(Span)TaggerBase<ClassificationTag>.OnTagsChanged(TagsChangedEventArgs)TaggerBase<ClassificationTag>.EditorTaggerBase<ClassificationTag>.DocumentTaggerBase<ClassificationTag>.TagsChanged

Constructors

Initializes a new instance of the WordTaggerBase class.

C#
protected WordTaggerBase(RadSyntaxEditor editor)
Parameters:editorRadSyntaxEditor

The editor.

Properties

Gets or sets a value indicating whether multiline tags are collected by this tagger instance. The method RebuildMultilineTags() process all document and collects Multiline tags in the MultilineTags property.

C#
public bool EnableMultilineTags { get; set; }

The list of multiline ClassificationTags wrapped in TagSpans.

C#
protected IList<TagSpan<ClassificationTag>> MultilineTags { get; }

Gets or sets the regex pattern used to match strings in the documents which this tagger recognizes.

C#
protected virtual string StringMatchingRegex { get; set; }

Methods

Adds a new word-type pair in the dictionary.

C#
public void AddWord(string word, ClassificationType classificationType)
Parameters:wordstringclassificationTypeClassificationType

Defines the different char types which is the essence of splitting words. A word is considered sequence of equally typed chars. 1 - whitespace, 2 - punctuation or symbol, 0 - letters and all other characters.

C#
protected virtual int GetCharType(char character)
Parameters:charactercharReturns:

int

Gets the tags.

C#
public override IEnumerable<TagSpan<ClassificationTag>> GetTags(NormalizedSnapshotSpanCollection spans)
Parameters:spansNormalizedSnapshotSpanCollectionReturns:

IEnumerable<TagSpan<ClassificationTag>>

Overrides: TaggerBase<ClassificationTag>.GetTags(NormalizedSnapshotSpanCollection)

Gets the words to classification types.

C#
protected abstract Dictionary<string, ClassificationType> GetWordsToClassificationTypes()
Returns:

Dictionary<string, ClassificationType>

Dictionary<System.String, ClassificationType>.

Clears all multiline tags and rebuilds them.

C#
protected virtual void InvalidateMultilineTags()

Called when a word is split during processing of a line string.

C#
protected virtual void OnWordSplit(int wordCharType, string word)
Parameters:wordCharTypeintwordstring

Rebuilds the MultilineTags collection.

C#
protected virtual void RebuildMultilineTags()

Splits the given string into collection of words.

C#
protected virtual IList<string> SplitIntoWords(string value)
Parameters:valuestring

The given string to split.

Returns:

IList<string>

List of the words.

Tries to get the classification type for the given string word.

C#
protected virtual bool TryGetClassificationType(string word, out ClassificationType classificationType)
Parameters:wordstring

The string word.

classificationTypeClassificationType

The result classification type.

Returns:

bool

Returns true if classification type is found, otherwise - false.

Tries to removes a given word from the dictionary.

C#
public bool TryRemoveWord(string word)
Parameters:wordstringReturns:

bool