Skip to content

Commit cb1c05b

Browse files
committed
Improve PowerShell Extension termination experience
We can now suppress the LSP library's duplicate notification, and we provide a promptable action to suppress our own.
1 parent 7b5cf12 commit cb1c05b

2 files changed

Lines changed: 22 additions & 9 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,10 +1043,10 @@
10431043
"default": false,
10441044
"markdownDescription": "Do not show the startup banner in the PowerShell Extension Terminal."
10451045
},
1046-
"powershell.showTerminalStoppedNotification": {
1046+
"powershell.suppressTerminalStoppedNotification": {
10471047
"type": "boolean",
1048-
"default": true,
1049-
"markdownDescription": "Show a notification when the PowerShell Extension terminal has stopped."
1048+
"default": false,
1049+
"markdownDescription": "Do not show a notification when the PowerShell Extension Terminal has stopped."
10501050
},
10511051
"powershell.integratedConsole.showOnStartup": {
10521052
"type": "boolean",

src/session.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,8 @@ export class SessionManager implements Middleware {
980980
return {
981981
action: CloseAction.DoNotRestart,
982982
message:
983-
"Connection to PowerShell Editor Services (the Extension Terminal) was closed. See below prompt to restart!",
983+
"Connection to PowerShell Editor Services (the Extension Terminal) was closed.",
984+
handled: true,
984985
};
985986
},
986987
},
@@ -1159,14 +1160,15 @@ Type 'help' to get help.
11591160

11601161
private async promptForRestart(): Promise<void> {
11611162
// Check user configuration before showing notification
1162-
const showNotifications = vscode.workspace
1163-
.getConfiguration("powershell")
1164-
.get<boolean>("showTerminalStoppedNotification", true);
1163+
const suppressNotification =
1164+
vscode.workspace
1165+
.getConfiguration("powershell")
1166+
.get<boolean>("suppressTerminalStoppedNotification") ?? false;
11651167

1166-
if (!showNotifications) {
1167-
// User opted out — silently skip the notification
1168+
if (suppressNotification) {
11681169
return;
11691170
}
1171+
11701172
await this.logger.writeAndShowErrorWithActions(
11711173
"The PowerShell Extension Terminal has stopped, would you like to restart it? IntelliSense and other features will not work without it!",
11721174
[
@@ -1180,6 +1182,17 @@ Type 'help' to get help.
11801182
prompt: "No",
11811183
action: undefined,
11821184
},
1185+
{
1186+
prompt: "Don't Show Again",
1187+
action: async (): Promise<void> => {
1188+
await changeSetting(
1189+
"suppressTerminalStoppedNotification",
1190+
true,
1191+
true,
1192+
this.logger,
1193+
);
1194+
},
1195+
},
11831196
],
11841197
);
11851198
}

0 commit comments

Comments
 (0)