Skip to content

Commit d2ff413

Browse files
Fix running indicator by ignoring PSRL aborts (#1096)
* fix running indicator by ignoring PSRL aborts * added comment on default * clearer logic
1 parent 1af7988 commit d2ff413

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,9 +1838,17 @@ public MinifiedRunspaceDetails(RunspaceDetails eventArgs)
18381838
/// <param name="e">details of the execution status change</param>
18391839
private void PowerShellContext_ExecutionStatusChangedAsync(object sender, ExecutionStatusChangedEventArgs e)
18401840
{
1841-
_languageServer?.SendNotification(
1842-
"powerShell/executionStatusChanged",
1843-
e);
1841+
// The cancelling of the prompt (PSReadLine) causes an ExecutionStatus.Aborted to be sent after every
1842+
// actual execution (ExecutionStatus.Running) on the pipeline. We ignore that event since it's counterintuitive to
1843+
// the goal of this method which is to send updates when the pipeline is actually running something.
1844+
// In the event that we don't know if it was a ReadLine cancel, we default to sending the notification.
1845+
var options = e?.ExecutionOptions;
1846+
if (options == null || !options.IsReadLine)
1847+
{
1848+
_languageServer?.SendNotification(
1849+
"powerShell/executionStatusChanged",
1850+
e);
1851+
}
18441852
}
18451853

18461854
#endregion

0 commit comments

Comments
 (0)