You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(Flutter) Allow cold boot launch using vs code command #3366
Is your feature request related to a problem? Please describe.
Sometimes it is necessary to fully boot the android based emulator (e.g. system buttons do not work). To fix the problem, the emulator instance needs a complete reboot.
A recent change to the flutter tooling is, that we can now cold boot android based emulators with an additional flag (--cold) which can be added to the --launch flag. (see flutter/flutter#82647)
Describe the solution you'd like
I would like an additional prompt that asks the user after emulator selection if it should be cold bootet ("yes" or "no", defaulting to "no").
In addition, the prompt will only be shown for android based emulators, since it is only available for android.
Describe alternatives you've considered
Alternative approach: A distinct command could be used (e.g. "Cold Launch Emulator"). Then no "yes" or "no" prompt would be shown.
I'm not sure I'd like to add an additional prompt (it would be an unnecessary step for the majority of the time), but perhaps we can list the emulator in the device selector twice, once with a "(cold boot)" suffix that would then pass this flag?
We should only show it if the Flutter SDK version supports the flag, and ofc only for android-based emulators.
The code the manages getting emulators etc. is in src/shared/vscode/device_manager.ts and the version numbers for checking capabilities go into src/shared/capabilities/flutter.ts. Related tests are in src/test/flutter/device_manager.test.ts (we should check that Android emulators get the extra option, but something else like iOS Simulator does not).
@DanTup, I saw that the extension uses the flutter daemon to launch emulators, but I assume that it does not support the cold boot[1]. The flag was added to the command line interface only. Do you think it would cause problems, if we use the command line interface instead of the daemon in case of cold boot selection?
Ah, good spot. It looks like that will first need updating in Flutter to support passing an argument then (and the docs here updating). I don't think switching to the command line is the best idea, we try to stick to structured APIs so that it's easier to return additional information/errors etc. which are much harder to handle from the editor if they're just text designed for users.
@DanTup, I tried to run some tests but for some reason later tests are failing with an error message from vs code: "Build errors exist in your project". It seems like the dart/flutter test projects are broken
Is it somehow possible to run selective tests only?
Here is the terminal output from the failing tests:
Running dart_debug tests folder in workspace hello_world
Attempting to download VS Code attempt #1
Found .vscode-test/vscode-win32-archive-1.56.2. Skipping download.
Running tests with pre-downloaded VS Code
Found .vscode-test/vscode-win32-archive-1.56.2. Skipping download.
Warning: 'sandbox' is not in the list of known options, but still passed to Electron/Chromium.
[main 2021-06-02T15:19:13.696Z] update#setState idle
(node:19404) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Code --trace-deprecation ...` to show where the warning was created)
Starting test runner...
(node:19404) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 pass listeners added to [Runner]. Use emitter.setMaxListeners() to increase limit
(node:19404) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 fail listeners added to [Runner]. Use emitter.setMaxListeners() to increase limit
dart cli debugger
[17:19:18] [General] [Warn] Project has errors, prompting user
[17:19:18] [General] [Warn] C:\Users\mtrie\gitrepos\Dart-Code\src\test\test_projects\hello_world\bin\deferred_entry.dart:0:7
[17:19:18] [General] [Warn] Target of URI doesn't exist: 'package:hello_world/deferred_script.dart'.
[main 2021-06-02T15:19:43.701Z] update#setState checking for updates
[main 2021-06-02T15:19:43.735Z] update#setState idle
1) runs to completion
@Hamdor it looks like you might be trying to run the Dart Debug tests, but probably you want to run just the Flutter tests. The best way to do this is selecting the Flutter Tests item in drop-down from the VS Code side bar and then running with F5/the green play button.
You can run individual tests by changing it("test name" to it.only("test name in the code (it's the Mocha framework being used).
The specific error stopping the Dart Debug tests from running is that you haven't run "pub get" in the test_projects\hello_world folder. You don't need to do this if you're not running those tests, though usually I open the entire test_projects folder in a VS Code window and accept when it asks to run pub get for all projects - that fetches the dependencies for all of the test projects that may be used in tests.
Activity
DanTup commentedon May 26, 2021
I'm not sure I'd like to add an additional prompt (it would be an unnecessary step for the majority of the time), but perhaps we can list the emulator in the device selector twice, once with a "(cold boot)" suffix that would then pass this flag?
We should only show it if the Flutter SDK version supports the flag, and ofc only for android-based emulators.
Hamdor commentedon May 26, 2021
The double listing is also a good idea. If you want I can try to implement that feature request.
DanTup commentedon May 26, 2021
That would be great!
The code the manages getting emulators etc. is in
src/shared/vscode/device_manager.tsand the version numbers for checking capabilities go intosrc/shared/capabilities/flutter.ts. Related tests are insrc/test/flutter/device_manager.test.ts(we should check that Android emulators get the extra option, but something else like iOS Simulator does not).Hamdor commentedon May 27, 2021
@DanTup, I saw that the extension uses the flutter daemon to launch emulators, but I assume that it does not support the cold boot[1]. The flag was added to the command line interface only. Do you think it would cause problems, if we use the command line interface instead of the daemon in case of cold boot selection?
[1] https://github.com/flutter/flutter/blob/b8a2456737c9645e5f3d7210fba6267f7408486f/packages/flutter_tools/lib/src/commands/daemon.dart#L1119
DanTup commentedon May 27, 2021
Ah, good spot. It looks like that will first need updating in Flutter to support passing an argument then (and the docs here updating). I don't think switching to the command line is the best idea, we try to stick to structured APIs so that it's easier to return additional information/errors etc. which are much harder to handle from the editor if they're just text designed for users.
Hamdor commentedon May 27, 2021
I created a feature request for that in the flutter repository here: flutter/flutter#83471
DanTup commentedon May 27, 2021
Thanks! Let me know if you're planning to contribute it there - if not, I can take a look. Thanks!
Hamdor commentedon May 27, 2021
I will contribute a pull request to flutter, should be no big change
Hamdor commentedon Jun 2, 2021
@DanTup, I tried to run some tests but for some reason later tests are failing with an error message from vs code: "Build errors exist in your project". It seems like the dart/flutter test projects are broken
Is it somehow possible to run selective tests only?
Here is the terminal output from the failing tests:
DanTup commentedon Jun 2, 2021
@Hamdor it looks like you might be trying to run the Dart Debug tests, but probably you want to run just the Flutter tests. The best way to do this is selecting the Flutter Tests item in drop-down from the VS Code side bar and then running with F5/the green play button.
You can run individual tests by changing
it("test name"toit.only("test namein the code (it's the Mocha framework being used).The specific error stopping the Dart Debug tests from running is that you haven't run "pub get" in the
test_projects\hello_worldfolder. You don't need to do this if you're not running those tests, though usually I open the entiretest_projectsfolder in a VS Code window and accept when it asks to runpub getfor all projects - that fetches the dependencies for all of the test projects that may be used in tests.Hamdor commentedon Jun 2, 2021
Thanks, that helps. I tried to just run "npm test" from terminal.