internal ClassifierAggregator(ITextView textView,
                                      IViewTagAggregatorFactoryService viewTagAggregatorFactory,
                                      IClassificationTypeRegistryService classificationTypeRegistry)
        {
            // Validate.
            if (textView == null)
            {
                throw new ArgumentNullException(nameof(textView));
            }
            if (viewTagAggregatorFactory == null)
            {
                throw new ArgumentNullException(nameof(viewTagAggregatorFactory));
            }
            if (classificationTypeRegistry == null)
            {
                throw new ArgumentNullException(nameof(classificationTypeRegistry));
            }

            _textBuffer = textView.TextBuffer;
            _classificationTypeRegistry = classificationTypeRegistry;

            // Create a tag aggregator that maps by content type, so we don't map through projection buffers that aren't "projection" content type.
            _tagAggregator = viewTagAggregatorFactory.CreateTagAggregator <IClassificationTag>(textView, TagAggregatorOptions.MapByContentType) as IAccurateTagAggregator <IClassificationTag>;
            _tagAggregator.BatchedTagsChanged += OnBatchedTagsChanged;
        }
Esempio n. 2
0
        internal ClassifierAggregator(ITextBuffer textBuffer,
                                      IBufferTagAggregatorFactoryService bufferTagAggregatorFactory,
                                      IClassificationTypeRegistryService classificationTypeRegistry)
        {
            // Validate.
            if (textBuffer == null)
            {
                throw new ArgumentNullException("textBuffer");
            }
            if (bufferTagAggregatorFactory == null)
            {
                throw new ArgumentNullException("bufferTagAggregatorFactory");
            }
            if (classificationTypeRegistry == null)
            {
                throw new ArgumentNullException("classificationTypeRegistry");
            }

            _textBuffer = textBuffer;
            _classificationTypeRegistry = classificationTypeRegistry;

            // Create a tag aggregator that maps by content type, so we don't map through projection buffers that aren't "projection" content type.
            _tagAggregator = bufferTagAggregatorFactory.CreateTagAggregator <IClassificationTag>(textBuffer, TagAggregatorOptions.MapByContentType | (TagAggregatorOptions)TagAggregatorOptions2.DeferTaggerCreation) as IAccurateTagAggregator <IClassificationTag>;
            _tagAggregator.BatchedTagsChanged += OnBatchedTagsChanged;
        }
        public void Dispose()
        {
            if (_tagAggregator != null)
            {
                _tagAggregator.BatchedTagsChanged -= OnBatchedTagsChanged;
                _tagAggregator.Dispose();

                _tagAggregator = null;
            }
        }
Esempio n. 4
0
        internal OutliningManager(ITextBuffer editBuffer, ITagAggregator <IOutliningRegionTag> tagAggregator, IEditorOptions options)
        {
            this.editBuffer    = editBuffer;
            this.tagAggregator = tagAggregator as IAccurateTagAggregator <IOutliningRegionTag>;

            bool keepTrackingCurrent = false;

            if (options != null && options.IsOptionDefined("Stress Test Mode", false))
            {
                keepTrackingCurrent = options.GetOptionValue <bool>("Stress Test Mode");
            }
            collapsedRegionTree = new TrackingSpanTree <Collapsed>(editBuffer, keepTrackingCurrent);

            tagAggregator.BatchedTagsChanged += OutliningRegionTagsChanged;
            this.editBuffer.Changed          += SourceTextChanged;
        }