@@ -34,6 +34,9 @@ export enum SessionStatus {
34
34
Failed ,
35
35
}
36
36
37
+ export const SendKeyPressNotificationType =
38
+ new NotificationType < void > ( "powerShell/sendKeyPress" ) ;
39
+
37
40
export class SessionManager implements Middleware {
38
41
public HostName : string ;
39
42
public HostVersion : string ;
@@ -605,6 +608,14 @@ export class SessionManager implements Middleware {
605
608
this . languageServerClient . onNotification (
606
609
RunspaceChangedEventType ,
607
610
( runspaceDetails ) => { this . setStatusBarVersionString ( runspaceDetails ) ; } ) ;
611
+
612
+ // NOTE: This fixes a quirk where PSES has a thread stuck on
613
+ // Console.ReadKey, since it's not cancellable. On
614
+ // "cancellation" the server asks us to send pretend to
615
+ // press a key, thus mitigating all the quirk.
616
+ this . languageServerClient . onNotification (
617
+ SendKeyPressNotificationType ,
618
+ ( ) => { this . languageServerProcess . sendKeyPress ( ) ; } ) ;
608
619
} ,
609
620
( reason ) => {
610
621
this . setSessionFailure ( "Could not start language service: " , reason ) ;
0 commit comments