Skip to content

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

@DanTup

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsin flutterRelates to running Flutter appsis enhancementrelies 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