Example #1
0
#pragma warning restore 67

        protected CommentTagger(IClassificationTypeRegistryService registry, ITagAggregator <IClassificationTag> aggregator, TaggerResult tags)
        {
            if (__CommentClassifications == null)
            {
                var t          = typeof(CommentStyleTypes);
                var styleNames = Enum.GetNames(t);
                __CommentClassifications = new ClassificationTag[styleNames.Length];
                foreach (var styleName in styleNames)
                {
                    var f = t.GetField(styleName);
                    var d = f.GetCustomAttribute <ClassificationTypeAttribute>();
                    if (d == null)
                    {
                        continue;
                    }
                    var ct = registry.GetClassificationType(d.ClassificationTypeNames);
                    __CommentClassifications[(int)f.GetValue(null)] = new ClassificationTag(ct);
                    __CommentClasses[ct] = true;
                }
            }

            _Aggregator              = aggregator;
            _Tags                    = tags;
            _Aggregator.TagsChanged += AggregatorBatchedTagsChanged;
        }
Example #2
0
 protected CachedTaggerBase(ITextView textView)
 {
     _TextView = textView;
     _Tags     = textView.Properties.GetOrCreateSingletonProperty(() => new TaggerResult());
 }
Example #3
0
        public static CommentTagger Create(IClassificationTypeRegistryService registry, ITagAggregator <IClassificationTag> aggregator, TaggerResult tags, ITextBuffer textBuffer)
        {
            switch (GetCodeType(textBuffer))
            {
            case CodeType.CSharp: return(new CSharpCommentTagger(registry, aggregator, tags));

            case CodeType.Markup: return(new MarkupCommentTagger(registry, aggregator, tags));

            case CodeType.C: return(new CCommentTagger(registry, aggregator, tags));

            case CodeType.Css: return(new CssCommentTagger(registry, aggregator, tags));

            case CodeType.Js: return(new JsCommentTagger(registry, aggregator, tags));
            }
            return(null);
        }
Example #4
0
 public MarkupCommentTagger(IClassificationTypeRegistryService registry, ITagAggregator <IClassificationTag> aggregator, TaggerResult tags) : base(registry, aggregator, tags)
 {
 }
Example #5
0
 public CSharpCommentTagger(IClassificationTypeRegistryService registry, ITagAggregator <IClassificationTag> aggregator, TaggerResult tags) : base(registry, aggregator, tags)
 {
     _PreprocessorKeyword = registry.GetClassificationType("preprocessor keyword");
 }