Skip to content
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/dap] Inform DAP client whether restart is supported #121610

Merged
merged 2 commits into from Mar 3, 2023

Conversation

DanTup
Copy link
Contributor

@DanTup DanTup commented Feb 28, 2023

Before this change, the Flutter adapter always sent "supportsRestartRequest: true" to the DAP client. This told the DAP client if the user clicks the "Restart" button on the debug toolbar that we (the DAP server) will handle the restart (allowing us to Hot Restart instead of a slower termination and restart of the entire debug session).

However, Profile/Release mode do not support Hot Restart, so this would result in an error "Hot Restart failed".

This change no longer sets supportsRestartRequest: true at startup, but instead waits for the app.start event, and sends the value of its supportsRestart field (an existing field that was already available in the app.start event).

This results in Hot Restart being available for debug builds, but the DAP client/IDE performing a full debug session restart for other modes.

Fixes Dart-Code/Dart-Code#4281.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Before this change, the Flutter adapter always sent "supportsRestartRequest: true" to the DAP client. This told the DAP client if the user clicks the "Restart" button on the debug toolbar that we (the DAP server) will handle the restart (allowing us to Hot Restart instead of a slower termination and restart of the entire debug session).

However, Profile/Release mode do not support Hot Restart, so this would result in an error "Hot Restart failed".

This change no longer sets `supportsRestartRequest: true` at startup, but instead waits for the `app.start` event, and sends the value of its `supportsRestart` field (an existing field that was already available in the `app.start` event).

This results in Hot Restart being available for debug builds, but the DAP client/IDE performing a full debug session restart for other modes.

Fixes Dart-Code/Dart-Code#4281.
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 28, 2023
@DanTup DanTup marked this pull request as ready for review February 28, 2023 16:23
Copy link
Member

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit about comment, but otherwise LGTM

…dart

Co-authored-by: Christopher Fujino <fujino@google.com>
@DanTup DanTup added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 3, 2023
@DanTup
Copy link
Contributor Author

DanTup commented Mar 3, 2023

Fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle debugger restart request (with a cold restart) for Flutter profile/release mode
2 participants