Skip to content

Commit 833a40d

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 4a2401c commit 833a40d

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
@@ -1037,10 +1037,10 @@
10371037
"default": false,
10381038
"markdownDescription": "Do not show the startup banner in the PowerShell Extension Terminal."
10391039
},
1040-
"powershell.showTerminalStoppedNotification": {
1040+
"powershell.suppressTerminalStoppedNotification": {
10411041
"type": "boolean",
1042-
"default": true,
1043-
"markdownDescription": "Show a notification when the PowerShell Extension terminal has stopped."
1042+
"default": false,
1043+
"markdownDescription": "Do not show a notification when the PowerShell Extension Terminal has stopped."
10441044
},
10451045
"powershell.integratedConsole.showOnStartup": {
10461046
"type": "boolean",

‎src/session.ts‎

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,8 @@ export class SessionManager implements Middleware {
955955
return {
956956
action: CloseAction.DoNotRestart,
957957
message:
958-
"Connection to PowerShell Editor Services (the Extension Terminal) was closed. See below prompt to restart!",
958+
"Connection to PowerShell Editor Services (the Extension Terminal) was closed.",
959+
handled: true,
959960
};
960961
},
961962
},
@@ -1134,14 +1135,15 @@ Type 'help' to get help.
11341135

11351136
private async promptForRestart(): Promise<void> {
11361137
// Check user configuration before showing notification
1137-
const showNotifications = vscode.workspace
1138-
.getConfiguration("powershell")
1139-
.get<boolean>("showTerminalStoppedNotification", true);
1138+
const suppressNotification =
1139+
vscode.workspace
1140+
.getConfiguration("powershell")
1141+
.get<boolean>("suppressTerminalStoppedNotification") ?? false;
11401142

1141-
if (!showNotifications) {
1142-
// User opted out — silently skip the notification
1143+
if (suppressNotification) {
11431144
return;
11441145
}
1146+
11451147
await this.logger.writeAndShowErrorWithActions(
11461148
"The PowerShell Extension Terminal has stopped, would you like to restart it? IntelliSense and other features will not work without it!",
11471149
[
@@ -1155,6 +1157,17 @@ Type 'help' to get help.
11551157
prompt: "No",
11561158
action: undefined,
11571159
},
1160+
{
1161+
prompt: "Don't Show Again",
1162+
action: async (): Promise<void> => {
1163+
await changeSetting(
1164+
"suppressTerminalStoppedNotification",
1165+
true,
1166+
true,
1167+
this.logger,
1168+
);
1169+
},
1170+
},
11581171
],
11591172
);
11601173
}

0 commit comments

Comments
 (0)