diff --git a/src/toolkit/Community.VisualStudio.Toolkit.Shared/MEF/SameWordHighlighterBase.cs b/src/toolkit/Community.VisualStudio.Toolkit.Shared/MEF/SameWordHighlighterBase.cs index 8ff3a2a..69d226d 100644 --- a/src/toolkit/Community.VisualStudio.Toolkit.Shared/MEF/SameWordHighlighterBase.cs +++ b/src/toolkit/Community.VisualStudio.Toolkit.Shared/MEF/SameWordHighlighterBase.cs @@ -19,6 +19,11 @@ public class SameWordHighlighterBase : IViewTaggerProvider [Import] internal ITextStructureNavigatorSelectorService? _textStructureNavigatorSelector = null; + /// + /// Return the tag name for the HighlightWord tags. Defaults to "MarkerFormatDefinition/HighlightWordFormatDefinition". + /// Can be overwritten in a subclass to change the format of the tags. + /// + public virtual string TextMarkerTagType => "MarkerFormatDefinition/HighlightWordFormatDefinition"; /// /// The Options that are used to find the matching words. The default implementation returns /// FindOptions.WholeWord | FindOptions.MatchCase @@ -50,7 +55,7 @@ public ITagger CreateTagger(ITextView textView, ITextBuffer buffer) where internal class HighlightWordTag : TextMarkerTag { - public HighlightWordTag() : base("MarkerFormatDefinition/HighlightWordFormatDefinition") { } + public HighlightWordTag(string tagName) : base(tagName) { } } internal class SameWordHighlighterTagger : ITagger, IDisposable @@ -190,13 +195,13 @@ public IEnumerable> GetTags(NormalizedSnapshotSpanCol // the duplication here is expected. if (spans.OverlapsWith(new NormalizedSnapshotSpanCollection(currentWord))) { - yield return new TagSpan(currentWord, new HighlightWordTag()); + yield return new TagSpan(currentWord, new HighlightWordTag(_tagger.TextMarkerTagType)); } // Second, yield all the other words in the file foreach (SnapshotSpan span in NormalizedSnapshotSpanCollection.Overlap(spans, wordSpans)) { - yield return new TagSpan(span, new HighlightWordTag()); + yield return new TagSpan(span, new HighlightWordTag(_tagger.TextMarkerTagType)); } }