Skip to content

Commit 68cf41f

Browse files
committed
Improve error message when DevTools isn't available
Fixes #3945.
1 parent 0be9453 commit 68cf41f

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎src/extension/commands/debug.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ export class DebugCommands implements IAmDisposable {
125125
return this.devTools.spawnForSession(session as DartDebugSessionInformation & { vmServiceUri: string }, { notify, page });
126126
} else if (session.session.configuration.noDebug) {
127127
vs.window.showInformationMessage("You must start your app with debugging in order to use DevTools.");
128+
} else if (session.hasStarted) {
129+
vs.window.showInformationMessage("DevTools is not available for an app running in this mode.");
128130
} else {
131+
// TODO: Remove the last part of this after the next Flutter release (after 3.0) when the appStarted event
132+
// is passed.
129133
vs.window.showInformationMessage("This debug session is not ready yet or does not support DevTools.");
130134
}
131135
}));
@@ -668,6 +672,8 @@ export class DebugCommands implements IAmDisposable {
668672
}
669673
clearTimeout(timer);
670674
this.suppressFlutterWidgetErrors = false;
675+
} else if (e.event === "flutter.appStarted") {
676+
session.hasStarted = true;
671677
}
672678
}
673679

‎src/extension/utils/vscode/debug.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class DartDebugSessionInformation {
66
public observatoryUri?: string;
77
public vmServiceUri?: string;
88
public readonly sessionStart: Date = new Date();
9+
public hasStarted = false;
910
public hasEnded = false;
1011
public progress: { [key: string]: ProgressMessage } = {};
1112
public readonly loadedServiceExtensions: VmServiceExtension[] = [];

0 commit comments

Comments
 (0)