@@ -2,7 +2,7 @@ import * as fs from "fs";
22import * as path from "path" ;
33import * as vs from "vscode" ;
44import { 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" ;
66import { DebuggerType , DebugOption , debugOptionNames , LogSeverity , VmServiceExtension } from "../../shared/enums" ;
77import { DartWorkspaceContext , DevToolsPage , Logger , LogMessage , WidgetErrorInspectData } from "../../shared/interfaces" ;
88import { 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