public AggregatingTagger(
                AbstractDiagnosticsTaggerProvider <TTag> owner,
                ITextBuffer subjectBuffer)
            {
                _owner         = owner;
                _subjectBuffer = subjectBuffer;

                var document = _subjectBuffer.AsTextContainer().GetOpenDocumentInCurrentContext();

                _currentDocumentId = document?.Id;

                // Kick off a background task to collect the initial set of diagnostics.
                var cancellationToken = _initialDiagnosticsCancellationSource.Token;
                var asyncToken        = _owner._listener.BeginAsyncOperation(GetType() + ".GetInitialDiagnostics");
                var task = Task.Run(() => GetInitialDiagnosticsInBackground(document, cancellationToken), cancellationToken);

                task.CompletesAsyncOperation(asyncToken);

                _taskChain = task;

                // Register to hear about diagnostics changing.  When we're notified about new
                // diagnostics (and those diagnostics are for our buffer), we'll ensure that
                // we have an underlying tagger responsible for asynchronously handling diagnostics
                // from the owner of that diagnostic update.
                _owner._diagnosticService.DiagnosticsUpdated += OnDiagnosticsUpdated;
            }
Пример #2
0
            public AggregatingTagger(
                AbstractDiagnosticsTaggerProvider <TTag> owner,
                ITextBuffer subjectBuffer)
            {
                _owner         = owner;
                _subjectBuffer = subjectBuffer;

                // Register to hear about diagnostics changing.  When we're notified about new
                // diagnostics (and those diagnostics are for our buffer), we'll ensure that
                // we have an underlying tagger responsible for asynchrounously handling diagnostics
                // from the owner of that diagnostic update.
                _owner._diagnosticService.DiagnosticsUpdated += OnDiagnosticsUpdated;
            }
 public TaggerProvider(AbstractDiagnosticsTaggerProvider <TTag> owner)
     : base(owner._listener, owner._notificationService)
 {
     _owner = owner;
 }