/// <summary> /// Creates a tag provider for the specified view and buffer. /// </summary> public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag { Trace(nameof(CreateTagger)); if (textView == null) { throw new ArgumentNullException("textView"); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (buffer != textView.TextBuffer) { return(null); } var textBlockStyler = MyUtil.GetTextBlockStyler(FormatMapService.GetEditorFormatMap(textView)); // FormatMapService.GetEditorFormatMap("text").GetProperties("Comment")["ForegroundColor"] var scope = new AdornmentTaggerScope { TextBlockStyler = textBlockStyler, WpfTextView = (IWpfTextView)textView }; ITagAggregator <TagData> CreateTagAggregator() { AdornmentTagger.scopeStatic = scope; var value = BufferTagAggregatorFactoryService.CreateTagAggregator <TagData>(textView.TextBuffer); AdornmentTagger.scopeStatic = null; return(value); } return(AdornmentTagger.GetTagger(new Lazy <ITagAggregator <TagData> >(CreateTagAggregator), scope) as ITagger <T>); }
public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer buffer) { return(new QuickInfoSource(this, buffer, BufferTagAggregatorFactoryService.CreateTagAggregator <ClassificationTag>(buffer))); }