Skip to content

Commit 2c0f2a9

Browse files
Copilotmotm32
andauthored
Close revision draft editor tab immediately on discard (#1047)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: motm32 <59709511+motm32@users.noreply.github.com>
1 parent 2d6dd92 commit 2c0f2a9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/commands/revisionDraft/RevisionDraftFileSystem.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { KnownActiveRevisionsMode, type Template } from "@azure/arm-appcontainers";
77
import { parseAzureResourceId, type ParsedAzureResourceId } from "@microsoft/vscode-azext-azureutils";
88
import { nonNullValueAndProp } from "@microsoft/vscode-azext-utils";
9-
import { Disposable, EventEmitter, FileChangeType, FileType, commands, window, workspace, type Event, type FileChangeEvent, type FileStat, type FileSystemProvider, type TextDocument, type Uri } from "vscode";
9+
import { Disposable, EventEmitter, FileChangeType, FileType, TabInputText, commands, window, workspace, type Event, type FileChangeEvent, type FileStat, type FileSystemProvider, type TextDocument, type Uri } from "vscode";
1010
import { URI } from "vscode-uri";
1111
import { ext } from "../../extensionVariables";
1212
import { ContainerAppItem, type ContainerAppModel } from "../../tree/ContainerAppItem";
@@ -179,6 +179,15 @@ export class RevisionDraftFileSystem implements FileSystemProvider {
179179
}
180180

181181
this.delete(uri);
182+
this.closeEditorForUri(uri);
183+
}
184+
185+
private closeEditorForUri(uri: Uri): void {
186+
const tabsToClose = window.tabGroups.all
187+
.flatMap(tabGroup => tabGroup.tabs)
188+
.filter(tab => tab.input instanceof TabInputText && tab.input.uri.scheme === uri.scheme && tab.input.uri.path === uri.path);
189+
190+
void window.tabGroups.close(tabsToClose);
182191
}
183192

184193
delete(uri: Uri): void {

0 commit comments

Comments
 (0)