Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ internal partial class DiagnosticIncrementalAnalyzer

public async override Task<ImmutableArray<DiagnosticData>> GetDiagnosticsAsync(Solution solution, ProjectId projectId, DocumentId documentId, bool includeSuppressedDiagnostics = false, CancellationToken cancellationToken = default(CancellationToken))
{
var diagnostics = await (new IDELatestDiagnosticGetter(this).GetDiagnosticsAsync(solution, projectId, documentId, cancellationToken)).ConfigureAwait(false);
var diagnostics = await (new IDELatestDiagnosticGetter(this, concurrent: documentId == null).GetDiagnosticsAsync(solution, projectId, documentId, cancellationToken)).ConfigureAwait(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you comment why this is the right thing? Nothing about there being a document or not indicates to me why we should be concurrent or not. Thanks!

return FilterSuppressedDiagnostics(diagnostics, includeSuppressedDiagnostics);
}

Expand Down Expand Up @@ -208,7 +208,7 @@ private async Task AppendDiagnosticsAsync(Project project, CancellationToken can
for (int i = 0; i < documents.Length; i++)
{
var document = documents[i];
tasks[i] = Task.Run(async () => await AppendDiagnosticsAsync(document, cancellationToken).ConfigureAwait(false), cancellationToken);
tasks[i] = AppendDiagnosticsAsync(document, cancellationToken);
};

await Task.WhenAll(tasks).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ private async Task<ImmutableArray<DiagnosticData>> GetAllDiagnosticsAsync(Func<P
var solution = _workspace.CurrentSolution;
foreach (var project in solution.Projects)
{
cancellationToken.ThrowIfCancellationRequested();

if (shouldFixInProject(project))
{
var diagnostics = await _diagnosticService.GetDiagnosticsAsync(solution, project.Id, includeSuppressedDiagnostics: true, cancellationToken: cancellationToken).ConfigureAwait(false);
Expand Down Expand Up @@ -226,6 +228,8 @@ private bool ApplySuppressionFix(IEnumerable<DiagnosticData> diagnosticsToFix, F
return;
}

cancellationToken.ThrowIfCancellationRequested();

// Equivalence key determines what fix will be applied.
// Make sure we don't include any specific diagnostic ID, as we want all of the given diagnostics (which can have varied ID) to be fixed.
var equivalenceKey = isAddSuppression ?
Expand All @@ -241,6 +245,8 @@ private bool ApplySuppressionFix(IEnumerable<DiagnosticData> diagnosticsToFix, F
// Use the Fix multiple occurrences service to compute a bulk suppression fix for the specified document and project diagnostics,
// show a preview changes dialog and then apply the fix to the workspace.

cancellationToken.ThrowIfCancellationRequested();

var documentDiagnosticsPerLanguage = GetDocumentDiagnosticsMappedToNewSolution(documentDiagnosticsToFixMap, newSolution, language);
if (!documentDiagnosticsPerLanguage.IsEmpty)
{
Expand All @@ -256,7 +262,7 @@ private bool ApplySuppressionFix(IEnumerable<DiagnosticData> diagnosticsToFix, F
equivalenceKey,
title,
waitDialogMessage,
cancellationToken: CancellationToken.None);
cancellationToken);
if (newSolution == null)
{
// User cancelled or fixer threw an exception, so we just bail out.
Expand All @@ -281,7 +287,7 @@ private bool ApplySuppressionFix(IEnumerable<DiagnosticData> diagnosticsToFix, F
equivalenceKey,
title,
waitDialogMessage,
CancellationToken.None);
cancellationToken);
if (newSolution == null)
{
// User cancelled or fixer threw an exception, so we just bail out.
Expand Down