Skip to content

Handle debugger restart request (with a cold restart) for Flutter profile/release mode #4281

Closed
flutter/flutter
#121610

Description

@DanTup

See #4276 (comment).


We can't hide the "restart" button (which we usually use for Hot Restart) because VS Code doesn't allow it (restart should always be possible, even if it's not a Hot Restart, because it should just be the same as stopping the session and starting it again). We also can't currently tell VS Code to handle the restart because we only know about profile/release flags in launchRequest (not during startup when capabilities are exchanged).

So there are a few options:

  1. Do nothing. This means the restart button on the debug toolbar will not work, and instead prints an error to the console in profile/release mode:

    Failed to Hot Restart: DebugAdapterException: Exception: Restart is not supported in profile mode

  2. Handle restartRequest in the DAP and terminate the flutter run process, clean up all state, and then restart it (this is probably the best solution, but also complex)
  3. Pass an additional flag for profile/release mode to the flutter debug_adapter process so it's known before launchRequest, and use that to set the supportsRestartRequest capability.

1 is ofc easiest, but I think we should probably do 2.

(on a related note, we should ensure Hot Restart commands are disabled/hidden from the palette etc., since we're just implementing a standard restart here, and having Hot Restart commands show up may be confusing where it's not supporting and we will do a cold restart).

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in flutterRelates to running Flutter apps
    in debuggingRelates to the debug adapter or process of running debug sessions
    on Nov 23, 2022
  2. modified the milestones: v3.54.0, v3.56.0 on Nov 23, 2022
  3. modified the milestones: v3.56.0, On Deck on Dec 12, 2022
  4. modified the milestones: On Deck, v3.62.0 on Feb 28, 2023
  5. DanTup commented on Feb 28, 2023

    @DanTup
    MemberAuthor

    We can use CapabilitiesEvent to advertise support for supportsRestartRequest later.

  6. DanTup commented on Feb 28, 2023

    @DanTup
    MemberAuthor
  7. DanTup commented on Mar 6, 2023

    @DanTup
    MemberAuthor
  8. added
    relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available
    on May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin flutterRelates to running Flutter appsis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.relies on sdk changesSomething that requires changes in the Dart/Flutter SDK to ship before it will become available

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions