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
Provide a command to get the ID of the selected device for use in tasks #4677
Comments
I can't think of a way to do this currently. Something that I think could be fairly easily supported though is a command that returns you the select devices ID, so you could do something like:
There's the possibility this command would return We could also set an environment variable ( |
I love it. |
Contributions are always welcome! I think you could probably do this with a new line below here: Dart-Code/src/extension/extension.ts Lines 322 to 323 in 8582fdc
With something like: context.subscriptions.push(vs.commands.registerCommand("flutter.getSelectedDeviceId", () => deviceManager?.currentDevice?.id)); You'd also need to add the command to To make the change and test it:
I don't have a good way to write an automated test for this right now (because the mock device manager isn't available in that code), but I think the code is simple enough to merge without. We should include a comment that the command may be used by users tasks and that it should not be removed even if it appears unused. |
Ok, I'll give it shot. And thanks for the spoon feeding. This makes it a lot easier and seems doable. |
I'm trying to pass the mobile deviceId to a flutter
preLaunchTask
. Minimal sample below, but ultimately it's asimctl
script that usesbooted
as the device id. However, this breaks down when I have multiple simulator devices booted, so I'm trying to explicitly run the preLaunch script with the target device.Does someone know how to do this? I've tried almost everything I could think of with variable substitution and environment variables (
printenv
shows nothing useful), but I can't find any hook intodeviceId
. It should be the same parameter passed to the-d
argument. Caveat: I can't use an explicitdeviceId
in the launch config because the config is checked in and shared with others, and we all use various versions of devices and Xcode.Can you help? :/
launch.json
tasks.json
The text was updated successfully, but these errors were encountered: