-
Notifications
You must be signed in to change notification settings - Fork 854
Auto-close Simple Browser tab when debug session ends #15895
Description
Description
When using the simpleBrowser option for aspire.dashboardBrowser, the Simple Browser tab should automatically close when the Aspire debug session ends (if aspire.closeDashboardOnDebugEnd is enabled).
This is currently blocked on VS Code — Simple Browser tabs report tab.input as undefined in the vscode.window.tabGroups API, making it impossible to reliably identify which tab is the dashboard Simple Browser tab. Without this, we risk closing an unrelated Simple Browser tab that the user opened independently.
What's needed from VS Code
VS Code needs to expose a proper TabInput type for Simple Browser tabs (e.g. TabInputWebview with a viewType or URL) so extensions can identify them. Currently:
// This is what we'd want to do, but tab.input is undefined for Simple Browser tabs
for (const group of vscode.window.tabGroups.all) {
for (const tab of group.tabs) {
// tab.input is undefined for Simple Browser — can't match by URL
}
}Related issues
- allow using vs code simple browser for dashboard launch #14942 — parent issue for Simple Browser dashboard launch support
- [SUGGESTION] Add the ability to choose which Browser to Launch on Debug AND enable choosing to close the browser on end of session vscode-dotnettools#1723 — user request for browser choice + auto-close on debug end
Implementation plan (once unblocked)
In closeDashboard() in AspireDebugSession.ts, find the Simple Browser tab by its URL/input type and close it via vscode.window.tabGroups.close().