public static async ValueTask <ImmutableArray <DiagnosticData> > GetDiagnosticsAsync( this IDiagnosticService service, Workspace workspace, Project?project, Document?document, bool includeSuppressedDiagnostics, bool forPullDiagnostics, Option2 <DiagnosticMode> diagnosticMode, CancellationToken cancellationToken) { Contract.ThrowIfTrue(document != null && document.Project != project); Contract.ThrowIfTrue(project != null && project.Solution.Workspace != workspace); using var _ = ArrayBuilder <DiagnosticData> .GetInstance(out var result); var buckets = forPullDiagnostics ? service.GetPullDiagnosticBuckets(workspace, project?.Id, document?.Id, diagnosticMode, cancellationToken) : service.GetPushDiagnosticBuckets(workspace, project?.Id, document?.Id, diagnosticMode, cancellationToken); foreach (var bucket in buckets) { Contract.ThrowIfFalse(workspace.Equals(bucket.Workspace)); Contract.ThrowIfFalse(document?.Id == bucket.DocumentId); var diagnostics = forPullDiagnostics ? await service.GetPullDiagnosticsAsync(bucket, includeSuppressedDiagnostics, diagnosticMode, cancellationToken).ConfigureAwait(false) : await service.GetPushDiagnosticsAsync(bucket, includeSuppressedDiagnostics, diagnosticMode, cancellationToken).ConfigureAwait(false); result.AddRange(diagnostics); } return(result.ToImmutable()); }
public static ValueTask <ImmutableArray <DiagnosticData> > GetPushDiagnosticsAsync( this IDiagnosticService service, Document document, bool includeSuppressedDiagnostics, DiagnosticMode diagnosticMode, CancellationToken cancellationToken) { return(service.GetPushDiagnosticsAsync(document.Project.Solution.Workspace, document.Project.Id, document.Id, id: null, includeSuppressedDiagnostics, diagnosticMode, cancellationToken)); }
public static ValueTask <ImmutableArray <DiagnosticData> > GetPushDiagnosticsAsync( this IDiagnosticService service, DiagnosticBucket bucket, bool includeSuppressedDiagnostics, Option2 <DiagnosticMode> diagnosticMode, CancellationToken cancellationToken ) => service.GetPushDiagnosticsAsync( bucket.Workspace, bucket.ProjectId, bucket.DocumentId, bucket.Id, includeSuppressedDiagnostics, diagnosticMode, cancellationToken );