The WordTaggerBase class works with the ClassificationTag and can be used when a certain word needs to be classified to one of the available classification types. Here's a list of the supported types:
Each of these types has a specified TextFormatDefinition which is used to display the matched words with a certain highlighting - foreground, background, border or underline.
The WordTaggerBase class exposes the following virtual methods:
- bool TryGetClassificationType(string word, out ClassificationType classificationType): Tries to get the classification type for the given string word.
- Dictionary<string, ClassificationType> GetWordsToClassificationTypes(): Gets a dictionary which assigns a classification type to a given word.
- IList<string> SplitIntoWords(string value): Splits the current line into a collection of words. These processed words are then assigned proper classification types in the GetTags method.
By inheriting the WordTaggerBase class you can create a tagger for your own custom language and specify custom words to be assigned to the list of available classification types. You can also define your own classification types if the default ones are not sufficient for you.
A practical example of how to define a tagger for your own custom language can be found here.
As of R3 2020, the WordTaggerBase class allows you to handle multiline tags by exposing the following members:
- EnableMultilineTags: A boolean property indicating whether multiline tags are collected by this tagger instance. Its default value is true.
- MultilineTags: A collection of type IList<TagSpan<ClassificationTag>> holding the multiline tags.
- RebuildMultilineTags: A method which rebuilds the MultilineTags collection.
- InvalidateMultilineTags: A method which clears all multiline tags and rebuilds them.