Skip to content

Commit 0ce9094

Browse files
Improve PowerShell Extension termination experience (#5380)
* Add setting to disable repeated PowerShell Extension Terminal stopped notifications * 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. --------- Co-authored-by: Andy Jordan <2226434+andyleejordan@users.noreply.github.com>
1 parent c5824e4 commit 0ce9094

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,6 +1043,11 @@
10431043
"default": false,
10441044
"markdownDescription": "Do not show the startup banner in the PowerShell Extension Terminal."
10451045
},
1046+
"powershell.suppressTerminalStoppedNotification": {
1047+
"type": "boolean",
1048+
"default": false,
1049+
"markdownDescription": "Do not show a notification when the PowerShell Extension Terminal has stopped."
1050+
},
10461051
"powershell.integratedConsole.showOnStartup": {
10471052
"type": "boolean",
10481053
"default": true,

src/session.ts

Lines changed: 23 additions & 1 deletion
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
},
@@ -1158,6 +1159,16 @@ Type 'help' to get help.
11581159
}
11591160

11601161
private async promptForRestart(): Promise<void> {
1162+
// Check user configuration before showing notification
1163+
const suppressNotification =
1164+
vscode.workspace
1165+
.getConfiguration("powershell")
1166+
.get<boolean>("suppressTerminalStoppedNotification") ?? false;
1167+
1168+
if (suppressNotification) {
1169+
return;
1170+
}
1171+
11611172
await this.logger.writeAndShowErrorWithActions(
11621173
"The PowerShell Extension Terminal has stopped, would you like to restart it? IntelliSense and other features will not work without it!",
11631174
[
@@ -1171,6 +1182,17 @@ Type 'help' to get help.
11711182
prompt: "No",
11721183
action: undefined,
11731184
},
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+
},
11741196
],
11751197
);
11761198
}

0 commit comments

Comments
 (0)