Skip to content

Commit cecc0be

Browse files
TadasCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <[email protected]>
1 parent 0bb08ad commit cecc0be

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/PowerShellEditorServices/Services/Analysis/AnalysisService.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ internal async Task DelayThenInvokeDiagnosticsAsync(ScriptFile fileToAnalyze, Co
348348
// Shouldn't start a new analysis task until:
349349
// 1. Delay/debounce period finishes (i.e. user has not started typing again)
350350
// 2. Previous analysis task finishes (runspace pool is capped at 1, so we'd be sitting in a queue there)
351-
Task debounceAndPrevious = Task.WhenAll(Task.Delay(_analysisDelayMillis), previousAnalysisTask ?? Task.CompletedTask);
351+
Task debounceAndPrevious = Task.WhenAll(Task.Delay(_analysisDelayMillis), previousAnalysisTask);
352352

353353
// In parallel, we will keep an eye on our cancellation token
354354
Task cancellationTask = Task.Delay(Timeout.Infinite, cancellationToken);
@@ -370,7 +370,8 @@ internal async Task DelayThenInvokeDiagnosticsAsync(ScriptFile fileToAnalyze, Co
370370
// Try to take the place of the currently running task by atomically writing our task in the fileAnalysisEntry.
371371
Task valueAtExchange = Interlocked.CompareExchange(ref fileAnalysisEntry.DiagnosticPublish, placeholder.Task, previousAnalysisTask);
372372

373-
if (valueAtExchange != previousAnalysisTask) {
373+
if (valueAtExchange != previousAnalysisTask)
374+
{
374375
// Some other task has managed to jump in front of us i.e. fileAnalysisEntry.DiagnosticPublish is
375376
// no longer equal to previousAnalysisTask which we noted down at the start of this method
376377
_logger.LogDebug("Failed to claim the running analysis task spot");

0 commit comments

Comments
 (0)