public override ImmutableArray <DiagnosticTableItem> GetItems()
                {
                    var diagnosticMode = _globalOptions.GetDiagnosticMode(InternalDiagnosticsOptions.NormalDiagnosticMode);
                    var provider       = _source._diagnosticService;
                    var items          = provider.GetPushDiagnosticsAsync(_workspace, _projectId, _documentId, _id, includeSuppressedDiagnostics: true, diagnosticMode, cancellationToken: CancellationToken.None)
                                         .AsTask()
                                         .WaitAndGetResult_CanCallOnBackground(CancellationToken.None)
                                         .Where(ShouldInclude)
                                         .Select(data => DiagnosticTableItem.Create(_workspace, data));

                    return(items.ToImmutableArray());
                }
            private void PopulateInitialData(Workspace workspace, IDiagnosticService diagnosticService)
            {
                var diagnosticMode = _globalOptions.GetDiagnosticMode(InternalDiagnosticsOptions.NormalDiagnosticMode);
                var diagnostics    = diagnosticService.GetPushDiagnosticBuckets(
                    workspace, projectId: null, documentId: null, diagnosticMode, cancellationToken: CancellationToken.None);

                foreach (var bucket in diagnostics)
                {
                    // We only need to issue an event to VS that these docs have diagnostics associated with them.  So
                    // we create a dummy notification for this.  It doesn't matter that it is 'DiagnosticsRemoved' as
                    // this doesn't actually change any data.  All that will happen now is that VS will call back into
                    // us for these IDs and we'll fetch the diagnostics at that point.
                    OnDataAddedOrChanged(DiagnosticsUpdatedArgs.DiagnosticsRemoved(
                                             bucket.Id, bucket.Workspace, solution: null, bucket.ProjectId, bucket.DocumentId));
                }
            }
Exemplo n.º 3
0
 ImmutableArray <DiagnosticData> IDiagnosticService.GetDiagnostics(Workspace workspace, ProjectId projectId, DocumentId documentId, object id, bool includeSuppressedDiagnostics, CancellationToken cancellationToken)
 => GetPushDiagnosticsAsync(workspace, projectId, documentId, id, includeSuppressedDiagnostics, _globalOptions.GetDiagnosticMode(InternalDiagnosticsOptions.NormalDiagnosticMode), cancellationToken).AsTask().WaitAndGetResult_CanCallOnBackground(cancellationToken);