Send progress notifications to clients during hot reload / hot restart (#112455)
This commit is contained in:
@@ -140,6 +140,13 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
|
||||
Future<void> attachImpl() async {
|
||||
final FlutterAttachRequestArguments args = this.args as FlutterAttachRequestArguments;
|
||||
|
||||
final DapProgressReporter progress = startProgressNotification(
|
||||
'launch',
|
||||
'Flutter',
|
||||
message: 'Attaching…',
|
||||
);
|
||||
unawaited(appStartedCompleter.future.then((_) => progress.end()));
|
||||
|
||||
final String? vmServiceUri = args.vmServiceUri;
|
||||
final List<String> toolArgs = <String>[
|
||||
'attach',
|
||||
@@ -255,6 +262,13 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
|
||||
Future<void> launchImpl() async {
|
||||
final FlutterLaunchRequestArguments args = this.args as FlutterLaunchRequestArguments;
|
||||
|
||||
final DapProgressReporter progress = startProgressNotification(
|
||||
'launch',
|
||||
'Flutter',
|
||||
message: 'Launching…',
|
||||
);
|
||||
unawaited(appStartedCompleter.future.then((_) => progress.end()));
|
||||
|
||||
final List<String> toolArgs = <String>[
|
||||
'run',
|
||||
'--machine',
|
||||
@@ -593,6 +607,14 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
|
||||
bool fullRestart, [
|
||||
String? reason,
|
||||
]) async {
|
||||
final String progressId = fullRestart ? 'hotRestart' : 'hotReload';
|
||||
final String progressMessage = fullRestart ? 'Hot restarting…' : 'Hot reloading…';
|
||||
final DapProgressReporter progress = startProgressNotification(
|
||||
progressId,
|
||||
'Flutter',
|
||||
message: progressMessage,
|
||||
);
|
||||
|
||||
try {
|
||||
await sendFlutterRequest('app.restart', <String, Object?>{
|
||||
'appId': appId,
|
||||
@@ -605,6 +627,9 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
|
||||
final String action = fullRestart ? 'Hot Restart' : 'Hot Reload';
|
||||
sendOutput('console', 'Failed to $action: $error');
|
||||
}
|
||||
finally {
|
||||
progress.end();
|
||||
}
|
||||
}
|
||||
|
||||
void _sendServiceExtensionStateChanged(vm.ExtensionData? extensionData) {
|
||||
|
||||
@@ -27,6 +27,7 @@ class FlutterAttachRequestArguments
|
||||
super.evaluateGettersInDebugViews,
|
||||
super.evaluateToStringInDebugViews,
|
||||
super.sendLogsToClient,
|
||||
super.sendCustomProgressEvents,
|
||||
});
|
||||
|
||||
FlutterAttachRequestArguments.fromMap(super.obj)
|
||||
@@ -99,6 +100,7 @@ class FlutterLaunchRequestArguments
|
||||
super.evaluateGettersInDebugViews,
|
||||
super.evaluateToStringInDebugViews,
|
||||
super.sendLogsToClient,
|
||||
super.sendCustomProgressEvents,
|
||||
});
|
||||
|
||||
FlutterLaunchRequestArguments.fromMap(super.obj)
|
||||
|
||||
Reference in New Issue
Block a user