Skip to content

Commit dee0434

Browse files
committed
Clean up "Terminating debug session" on restarts
Fixes #3358.
1 parent 170653e commit dee0434

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎src/extension/commands/debug.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as fs from "fs";
22
import * as path from "path";
33
import * as vs from "vscode";
44
import { FlutterCapabilities } from "../../shared/capabilities/flutter";
5-
import { devToolsPages, doNotAskAgainAction, isInFlutterDebugModeDebugSessionContext, isInFlutterProfileModeDebugSessionContext, widgetInspectorPage } from "../../shared/constants";
5+
import { debugLaunchProgressId, debugTerminatingProgressId, devToolsPages, doNotAskAgainAction, isInFlutterDebugModeDebugSessionContext, isInFlutterProfileModeDebugSessionContext, widgetInspectorPage } from "../../shared/constants";
66
import { DebuggerType, DebugOption, debugOptionNames, LogSeverity, VmServiceExtension } from "../../shared/enums";
77
import { DartWorkspaceContext, DevToolsPage, Logger, LogMessage, WidgetErrorInspectData } from "../../shared/interfaces";
88
import { PromiseCompleter } from "../../shared/utils";
@@ -521,6 +521,14 @@ export class DebugCommands {
521521
}
522522
}
523523
} else if (e.event === "dart.progressStart") {
524+
// When a debug session is restarted by VS Code (eg. not handled by the DA), the session-end event
525+
// will not fire so we need to clean up the "Terminating debug session" message manually. Doing it here
526+
// means it will vanish at the same time as the new one appears, so there are no gaps in progress indicators.
527+
if (e.body.progressID === debugLaunchProgressId) {
528+
session.progress[debugTerminatingProgressId]?.complete();
529+
delete session.progress[debugTerminatingProgressId];
530+
}
531+
524532
const isHotEvent = e.body.progressID.endsWith("-hot.reload") || e.body.progressID.endsWith("-hot.restart");
525533
const progressLocation = isHotEvent && config.hotReloadProgress === "statusBar" ? vs.ProgressLocation.Window : vs.ProgressLocation.Notification;
526534

0 commit comments

Comments
 (0)