Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f559375

Browse files
Add sendKeyPress notification used to "cancel" Console.ReadKey (#3911)
1 parent 7fdf61f commit f559375

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

‎src/process.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ export class PowerShellProcess {
163163
}
164164
}
165165

166+
public sendKeyPress() {
167+
this.consoleTerminal.sendText("0円", false);
168+
}
169+
166170
private logTerminalPid(pid: number, exeName: string) {
167171
this.log.write(`${exeName} PID: ${pid}`);
168172
}

‎src/session.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export enum SessionStatus {
3434
Failed,
3535
}
3636

37+
export const SendKeyPressNotificationType =
38+
new NotificationType<void>("powerShell/sendKeyPress");
39+
3740
export class SessionManager implements Middleware {
3841
public HostName: string;
3942
public HostVersion: string;
@@ -605,6 +608,14 @@ export class SessionManager implements Middleware {
605608
this.languageServerClient.onNotification(
606609
RunspaceChangedEventType,
607610
(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(); });
608619
},
609620
(reason) => {
610621
this.setSessionFailure("Could not start language service: ", reason);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /