Skip to content

Commit 7b8c4d9

Browse files
author
Hiroki Okada
authored
Fixes #6742. Suppress unsaved changes warning for qa! (#9783)
We now iterate over all open tabs and call `workbench.action.revertAndCloseActiveEditor` for each one to ensure that changes are discarded without prompting, honoring the force-quit (`!`) option.
1 parent a0b824f commit 7b8c4d9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cmd_line/commands/quit.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ export class QuitCommand extends ExCommand {
4949
}
5050

5151
if (this.arguments.quitAll) {
52-
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
52+
if (!this.arguments.bang) {
53+
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
54+
} else {
55+
const totalTabCount = vscode.window.tabGroups.all.flatMap((group) => group.tabs).length;
56+
for (let i = 0; i < totalTabCount; i++) {
57+
await vscode.commands.executeCommand('workbench.action.revertAndCloseActiveEditor');
58+
}
59+
}
5360
} else {
5461
if (!this.arguments.bang) {
5562
await vscode.commands.executeCommand('workbench.action.closeActiveEditor');

0 commit comments

Comments
 (0)