Fix debug adapter config bugs and add missing config options#66
Merged
MrSubidubi merged 3 commits intoJul 17, 2026
Merged
Conversation
- Fix `type` field sending "flutter.bat" instead of "flutter" on Windows - Fix `stopOnEntry` being hardcoded to false, now reads user config - Fix `flutterMode` being hardcoded to "debug", now configurable - Fix `vmServiceUri: null` always sent in config, now only when provided - Fix `fvm` task commands using invalid "fvm flutter" as command - Add `toolArgs`, `env`, and `flutterMode` config support - Add `sendLogsToClient: true` for debug log forwarding - Fix typo "Weather" -> "Whether" in schema Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
nelsoncampos-cloudwalk
force-pushed
the
fix/hot-reload-and-rerun-session
branch
from
March 11, 2026 02:58
4f7cf5e to
1a2e06b
Compare
MrSubidubi
requested changes
Mar 20, 2026
MrSubidubi
left a comment
Contributor
There was a problem hiding this comment.
Looks good overall, could you please look into the CI issue?
This was referenced May 7, 2026
|
I'm interested in seeing this PR merged @nelsoncampos-cloudwalk if you could address the changes. Copilot in the runner logs helps explain the fix |
MrSubidubi
pushed a commit
that referenced
this pull request
Jul 20, 2026
## Summary Closes #85. The `device_id` field in `.zed/debug.json` is currently a no-op for Flutter launches. The extension reads it and forwards it as `deviceId` in the DAP launch JSON, but Flutter's DAP (`flutter_tools/lib/src/debug_adapters/flutter_adapter.dart`) does not read that field — `grep -r deviceId packages/flutter_tools/lib/src/debug_adapters/` returns a single hit and it's a comment. Only `toolArgs` is forwarded to `flutter run --machine`. This PR forwards `device_id` as `["-d", <id>]` in `toolArgs` so device selection actually works, and defines how it interacts with the user-facing `toolArgs` option added in #66. ## Changes - `src/dart.rs`: - When `device_id` is set explicitly, append `["-d", <id>]` to the user's `toolArgs` — but only if the user hasn't already passed a device flag (`-d` / `--device-id`) themselves. In that case the user's `toolArgs` takes precedence. - The injection is gated to `flutter` mode only (`dart run` has no `-d` flag). - If `device_id` is not set, nothing is injected — Flutter's auto-pick stays in effect (preserves current behavior for users who don't specify a device). - Removed the phantom `"chrome"` default for the `deviceId` JSON field. It was never read by Flutter's DAP, and now that device selection flows through `-d`, an unconditional default there would hijack Flutter's auto-pick. `deviceId` is now emitted only when the user sets it, kept purely for forward-compat in case Flutter ever wires it up. - `debug_adapter_schemas/Dart.json`: documented `device_id` and its precedence relative to `toolArgs`. ## Precedence | User config | Result | |---|---| | `device_id` unset | Flutter auto-picks a device (unchanged) | | `device_id: "macos"` | `flutter run -d macos` | | `device_id` set + `-d`/`--device-id` already in `toolArgs` | user's `toolArgs` wins, no injection | | `type: "dart"` | no `-d` injection (dart has no device flag) | ## Verification **DAP-level** (hand-built launch requests piped to `flutter debug_adapter`, Flutter 3.41.6 stable): | Launch JSON | Result | |---|---| | `{"deviceId": "macos", ...}` (old behavior) | "More than one device connected", exits | | `{"toolArgs": ["-d", "macos"], ...}` (this PR) | macOS app launches successfully | **End-to-end in Zed** (patched extension installed as a dev extension, Flutter 3.41.6, with an Android emulator + macOS desktop + Chrome web all available): - [x] `device_id: "macos"` → launches on macOS (previously hijacked to the running emulator) - [x] No `device_id` set → Flutter's auto-pick selects the emulator (current behavior unchanged) - [x] `device_id` + explicit `-d` in `toolArgs` → user's `toolArgs` wins ## Related - #66 added the user-facing `toolArgs` config field. This PR builds on it: `device_id` is merged into `toolArgs`, with the user's explicit device flag taking precedence. - #72 includes the same `-d <id>` via `toolArgs` mechanism as part of its hot-reload feature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix several bugs in the debug adapter configuration and add missing config options.
Bug fixes:
typefield in DAP config was set to the tool binary name (flutter.baton Windows) instead of"flutter"/"dart", breaking the debug adapter on WindowsstopOnEntrywas hardcoded tofalse, ignoring the user's settingflutterModewas hardcoded to"debug"— now reads from user config (supportsdebug,profile,release,test)vmServiceUri: nullwas always included in the config even for launch requests, now only included when providedfvmtasks had"command": "fvm flutter"(space in command), fixed to"command": "fvm"with"flutter"as first argNew config options:
toolArgs— pass arguments to the Flutter/Dart tool (e.g.--flavor,-d chrome)env— environment variables for the debug adapterflutterMode— configurable Flutter modesendLogsToClient: true— enables debug adapter log forwarding to Zed