/// <summary> /// Создает теггер для списка ошибок. /// </summary> /// <typeparam name="T">Тип тега.</typeparam> /// <param name="textView">Текущее view.</param> /// <param name="buffer">Текущий буфер.</param> /// <returns>Теггер.</returns> public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag { if (textView == null) { throw new ArgumentNullException("textView"); } if (textView.TextBuffer != buffer) { return(null); } if (buffer == null) { throw new ArgumentNullException("buffer"); } SpellErrorTagger tagger; if (textView.Properties.TryGetProperty(typeof(SpellErrorTagger), out tagger)) { return(tagger as ITagger <T>); } var classifierAggregator = ClassifierAggregatorService.GetClassifier(buffer); tagger = new SpellErrorTagger(textView, buffer, classifierAggregator); textView.Properties[typeof(SpellErrorTagger)] = tagger; return(tagger as ITagger <T>); }
public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag { if (buffer == null) { throw new ArgumentNullException("buffer"); } // Due to an issue with the built-in C# classifier, we avoid using it. if (buffer.ContentType.IsOfType("csharp")) { return(new CSharpCommentTextTagger(buffer) as ITagger <T>); } var classifierAggregator = ClassifierAggregatorService.GetClassifier(buffer); return(new CommentTextTagger(buffer, classifierAggregator) as ITagger <T>); }
public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag { if (_reentrant) { return(null); } if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } _reentrant = true; var classifierAggregator = ClassifierAggregatorService.GetClassifier(buffer); _reentrant = false; return(new FontChangerTagger(buffer, classifierAggregator) as ITagger <T>); }