Пример #1
0
            public Tagger(
                CopyPasteAndPrintingClassificationBufferTaggerProvider owner,
                ITextBuffer subjectBuffer,
                IAsynchronousOperationListener asyncListener,
                IGlobalOptionService globalOptions)
                : base(owner.ThreadingContext)
            {
                _owner         = owner;
                _subjectBuffer = subjectBuffer;
                _globalOptions = globalOptions;

                // Note: because we use frozen-partial documents for semantic classification, we may end up with incomplete
                // semantics (esp. during solution load).  Because of this, we also register to hear when the full
                // compilation is available so that reclassify and bring ourselves up to date.
                _eventSource = new CompilationAvailableTaggerEventSource(
                    subjectBuffer,
                    asyncListener,
                    TaggerEventSources.OnWorkspaceChanged(subjectBuffer, asyncListener),
                    TaggerEventSources.OnDocumentActiveContextChanged(subjectBuffer));

                _eventSource.Changed += OnEventSourceChanged;
                _eventSource.Connect();
            }
            public Tagger(
                SemanticClassificationBufferTaggerProvider owner,
                ITextBuffer subjectBuffer,
                IAsynchronousOperationListener asyncListener)
                : base(owner.ThreadingContext)
            {
                _owner         = owner;
                _subjectBuffer = subjectBuffer;

                const TaggerDelay Delay = TaggerDelay.Short;

                // Note: because we use frozen-partial documents for semantic classification, we may end up with incomplete
                // semantics (esp. during solution load).  Because of this, we also register to hear when the full
                // compilation is available so that reclassify and bring ourselves up to date.
                _eventSource = new CompilationAvailableTaggerEventSource(
                    subjectBuffer, Delay,
                    owner.ThreadingContext,
                    asyncListener,
                    TaggerEventSources.OnWorkspaceChanged(subjectBuffer, Delay, asyncListener),
                    TaggerEventSources.OnDocumentActiveContextChanged(subjectBuffer, Delay));

                ConnectToEventSource();
            }