File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
src/PowerShellEditorServices.Protocol Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ using Microsoft . PowerShell . EditorServices . Protocol . MessageProtocol ;
2
+
3
+ namespace Microsoft . PowerShell . EditorServices . Protocol . LanguageServer
4
+ {
5
+ /// <summary>
6
+ /// Defines an event type for PowerShell context execution status changes (e.g. execution has completed)
7
+ /// </summary>
8
+ public class ExecutionStatusChangedEvent
9
+ {
10
+ /// <summary>
11
+ /// The notification type for execution status change events in the message protocol
12
+ /// </summary>
13
+ public static readonly
14
+ NotificationType < object , object > Type =
15
+ NotificationType < object , object > . Create ( "powerShell/executionStatusChanged" ) ;
16
+ }
17
+ }
Original file line number Diff line number Diff line change @@ -56,7 +56,9 @@ public LanguageServer(
56
56
{
57
57
this . Logger = logger ;
58
58
this . editorSession = editorSession ;
59
+ // Attach to the underlying PowerShell context to listen for changes in the runspace or execution status
59
60
this . editorSession . PowerShellContext . RunspaceChanged += PowerShellContext_RunspaceChanged ;
61
+ this . editorSession . PowerShellContext . ExecutionStatusChanged += PowerShellContext_ExecutionStatusChanged ;
60
62
61
63
// Attach to ExtensionService events
62
64
this . editorSession . ExtensionService . CommandAdded += ExtensionService_ExtensionAdded ;
@@ -1273,6 +1275,18 @@ await this.messageSender.SendEvent(
1273
1275
new Protocol . LanguageServer . RunspaceDetails ( e . NewRunspace ) ) ;
1274
1276
}
1275
1277
1278
+ /// <summary>
1279
+ /// Event hook on the PowerShell context to listen for changes in script execution status
1280
+ /// </summary>
1281
+ /// <param name="sender">the PowerShell context sending the execution event</param>
1282
+ /// <param name="e">details of the execution status change</param>
1283
+ private async void PowerShellContext_ExecutionStatusChanged ( object sender , ExecutionStatusChangedEventArgs e )
1284
+ {
1285
+ await this . messageSender . SendEvent (
1286
+ ExecutionStatusChangedEvent . Type ,
1287
+ e ) ;
1288
+ }
1289
+
1276
1290
private async void ExtensionService_ExtensionAdded ( object sender , EditorCommand e )
1277
1291
{
1278
1292
await this . messageSender . SendEvent (
You can’t perform that action at this time.
0 commit comments