-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flutter_tools] Add support for vmServiceFileInfo when attaching #128503
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,12 @@ import 'package:vm_service/vm_service.dart' as vm; | |
import '../base/io.dart'; | ||
import '../cache.dart'; | ||
import '../convert.dart'; | ||
import '../globals.dart' as globals show fs; | ||
import 'flutter_adapter_args.dart'; | ||
import 'flutter_base_adapter.dart'; | ||
|
||
/// A DAP Debug Adapter for running and debugging Flutter applications. | ||
class FlutterDebugAdapter extends FlutterBaseDebugAdapter { | ||
class FlutterDebugAdapter extends FlutterBaseDebugAdapter with VmServiceInfoFileUtils { | ||
FlutterDebugAdapter( | ||
super.channel, { | ||
required super.fileSystem, | ||
|
@@ -120,14 +121,28 @@ class FlutterDebugAdapter extends FlutterBaseDebugAdapter { | |
@override | ||
Future<void> attachImpl() async { | ||
final FlutterAttachRequestArguments args = this.args as FlutterAttachRequestArguments; | ||
String? vmServiceUri = args.vmServiceUri; | ||
final String? vmServiceInfoFile = args.vmServiceInfoFile; | ||
|
||
if (vmServiceUri != null && vmServiceInfoFile != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if they're both null? Do we try to discover it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, I've made the error text a bit clearer (and also reintroduced this explanation in the readme noted above). |
||
sendConsoleOutput( | ||
'To attach, provide only one of vmServiceUri/vmServiceInfoFile', | ||
); | ||
handleSessionTerminate(); | ||
return; | ||
} | ||
|
||
launchProgress = startProgressNotification( | ||
'launch', | ||
'Flutter', | ||
message: 'Attaching…', | ||
); | ||
|
||
final String? vmServiceUri = args.vmServiceUri; | ||
if (vmServiceUri == null && vmServiceInfoFile != null) { | ||
final Uri uriFromFile = await waitForVmServiceInfoFile(logger, globals.fs.file(vmServiceInfoFile)); | ||
vmServiceUri = uriFromFile.toString(); | ||
} | ||
|
||
final List<String> toolArgs = <String>[ | ||
'attach', | ||
'--machine', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this now non-nullable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, no - apparently I pasted the Dart version over this and didn't check it properly (it's wrong there, and I also lost the additional explanatory text). Fixed!