Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed Jul 2, 2021
1 parent a122223 commit 8e10133
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private void OnDiagnosticsUpdated(object? sender, DiagnosticsUpdatedArgs updateA
continue;
}

if (HaveDiagnosticsChangedAndUpdateCache(documentToPreviousDiagnosticParams, document, out var newResultId))
if (HaveDiagnosticsChanged(documentToPreviousDiagnosticParams, document, out var newResultId))
{
context.TraceInformation($"Diagnostics were changed for document: {document.FilePath}");
progress.Report(await ComputeAndReportCurrentDiagnosticsAsync(context, document, newResultId, cancellationToken).ConfigureAwait(false));
Expand Down Expand Up @@ -267,12 +267,12 @@ private void HandleRemovedDocuments(RequestContext context, DiagnosticParams[] p
/// <param name="documentToPreviousDiagnosticParams">the resultIds the client sent us.</param>
/// <param name="document">the document we are currently calculating results for.</param>
/// <param name="newResultId">the resultId to report new diagnostics with if changed.</param>
private bool HaveDiagnosticsChangedAndUpdateCache(
private bool HaveDiagnosticsChanged(
Dictionary<Document, DiagnosticParams> documentToPreviousDiagnosticParams,
Document document,
[NotNullWhen(true)] out string? newResultId)
{
// Read and write the cached resultId to _documentIdToLastResultId in a single 'transaction'
// Read and write the cached resultId to _documentIdToLastResultId in a single transaction
// to prevent in-between updates to _documentIdToLastResultId triggered by OnDiagnosticsUpdated.
lock (_gate)
{
Expand Down

0 comments on commit 8e10133

Please sign in to comment.