diff --git a/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs b/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs index 3f1a03c32..3043174eb 100644 --- a/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs +++ b/src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs @@ -1838,9 +1838,17 @@ public MinifiedRunspaceDetails(RunspaceDetails eventArgs) /// details of the execution status change private void PowerShellContext_ExecutionStatusChangedAsync(object sender, ExecutionStatusChangedEventArgs e) { - _languageServer?.SendNotification( - "powerShell/executionStatusChanged", - e); + // The cancelling of the prompt (PSReadLine) causes an ExecutionStatus.Aborted to be sent after every + // actual execution (ExecutionStatus.Running) on the pipeline. We ignore that event since it's counterintuitive to + // the goal of this method which is to send updates when the pipeline is actually running something. + // In the event that we don't know if it was a ReadLine cancel, we default to sending the notification. + var options = e?.ExecutionOptions; + if (options == null || !options.IsReadLine) + { + _languageServer?.SendNotification( + "powerShell/executionStatusChanged", + e); + } } #endregion