Skip to content

Support debug/flutter adapter, update Zed dependencies #16

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Dixzz
Copy link

@Dixzz Dixzz commented Jun 20, 2025

🧩 Summary

This PR integrates Dart Debug Adapter Protocol (DAP) support into zed-extensions/dart, allowing interactive debugging sessions directly within Zed via dart debug_adapter

IMPORTANT

Make sure you have: in project path .zed/debug.json

[
  {
    "label": "Debug Flutter App",
    "adapter": "Dart", // DO NOT EDIT
    "type": "flutter",
    "program": "lib/main.dart",
    "args": ["--web-port=9090"]
  }
]

Steps shown:

  1. Launch Debug Flutter App task in Zed using F4 or command pallet debugger: start
  2. Hit breakpoint at main.dart
  3. Inspect variable frames
  4. Step through code

📸 Screenshots

Description Image
Debug session launched screenshot1

All supported schema for .zed/debug.json config

{
    "adapter": {
      "type": "string",
      "enum": ["Dart"]
    },
    "type": {
      "type": "string",
      "enum": ["dart", "flutter"],
      "description": "Debug Flutter or Dart file"
    },
    "label": {
      "type": "string",
      "description": "Human-readable name for this debug configuration",
      "examples": ["Launch Dart App", "Debug Main", "Dart Console"]
    },
    "program": {
      "type": "string",
      "description": "Path to the Dart file to debug",
      "examples": ["lib/main.dart", "bin/main.dart", "test/example_test.dart"]
    },
    "args": {
      "type": "array",
      "description": "Arguments passed to the Dart program.",
      "items": {
        "type": "string"
      },
      "default": []
    },
    "device_id": {
      "type": "string",
      "examples": ["chrome", "edge", "<android-id>", "<ios-id>"]
    },
    "platform": {
      "type": "string",
      "examples": ["web", "desktop"]
    },
    "stopOnEntry": {
      "type": "boolean",
      "description": "Pause debugger on entry.",
      "default": false
    }
  }

This comment was marked as resolved.

@Dixzz

This comment was marked as resolved.

@cla-bot cla-bot bot added the cla-signed label Jun 20, 2025

This comment was marked as resolved.

@Dixzz
Copy link
Author

Dixzz commented Jun 20, 2025

Tested on:
Zed Preview: v0.192.3-pre
Flutter Version: Flutter 3.29.3

@Dixzz Dixzz mentioned this pull request Jun 21, 2025
@maxdeviant maxdeviant changed the title support debug/flutter adapter, update zed deps Support debug/flutter adapter, update Zed dependencies Jun 23, 2025
@aikins01
Copy link

@Dixzz I'd like to take over working on this

@dario-valles
Copy link

Any way I can help on this? I really would like to see this live! @Dixzz @aikins01 ?

Dixzz added 2 commits July 23, 2025 23:14
Align the name of adapter with standards
@Dixzz
Copy link
Author

Dixzz commented Jul 23, 2025

@aikins01 @dario-valles
There aren't any implementation at this moment but we can work on it at our pace

  1. fvm custom path for flutter SDK binaries
  2. Cross platform support (windows, mac, linux) when debugger is active (currently tested on Linux)

@felipecarvalho
Copy link

Any way I can help on this? I really would like to see this live! @Dixzz @aikins01 ?

Me too, we need this feature 🎉

@caturbgs
Copy link

Is there any ETA for this PR? 👀👀

@fstof
Copy link

fstof commented Aug 1, 2025

I tested now on Zed 0.197.3
Installed this PR extension

I can't say that it works for me.
Hitting F4 shows the debug tasks as specified in debug.json but they do nothing

Plain dart as well as flutter apps do not start up
Here is my .zed/debug.json

[
  {
    "label": "Debug Flutter App",
    "adapter": "dart",
    "type": "flutter",
    "program": "lib/main.dart",
    "args": ["--web-port=9090"]
  },
  {
    "adapter": "dart",
    "type": "dart",
    "label": "Launch Dart App",
    "program": "lib/plain.dart",
    "stopOnEntry": false
  }
]

Am I missing something?

@dcrebbin
Copy link

dcrebbin commented Aug 6, 2025

Any updates on this

@peet0r
Copy link

peet0r commented Aug 10, 2025

Confirmed this PR is functional on Zed 0.198.5 when the following is added to .zed/debug.json in my flutter project:

{
    "label": "Debug Flutter App",
    "adapter": "Dart",
    "type": "flutter",
    "program": "lib/main.dart",
    "args": ["--web-port=9090", "-d", "macos"]
  }

Please note the device was set to macos so update for your device[s].

How much testing to we need to undertake to get this merged?

@peet0r
Copy link

peet0r commented Aug 10, 2025

I guess I should compile a few readme improvements...I'll push those shortly.

@Dixzz
Copy link
Author

Dixzz commented Aug 11, 2025

I tested now on Zed 0.197.3 Installed this PR extension

I can't say that it works for me. Hitting F4 shows the debug tasks as specified in debug.json but they do nothing

Plain dart as well as flutter apps do not start up Here is my .zed/debug.json

[
  {
    "label": "Debug Flutter App",
    "adapter": "dart",
    "type": "flutter",
    "program": "lib/main.dart",
    "args": ["--web-port=9090"]
  },
  {
    "adapter": "dart",
    "type": "dart",
    "label": "Launch Dart App",
    "program": "lib/plain.dart",
    "stopOnEntry": false
  }
]

Am I missing something?

Please provide:

Logs of flutter doctor
Zed version used
Platform you're running on

@peet0r
Copy link

peet0r commented Aug 11, 2025

FYI @Dixzz @fstof, the change from dart -> Dart tricked me during setup. When using dart with zed --foreground the logs were silent, which was confusing

@vleeuwenmenno
Copy link

vleeuwenmenno commented Aug 13, 2025

I can confirm the same issue as @fstof, I can see the debug targets but spawning them does nothing.

image
[
  {
    "label": "Debug Flutter App",
    "adapter": "dart",
    "type": "flutter",
    "program": "lib/main.dart",
    "args": ["--web-port=9090"]
  }
]

On 801b322 for this extension (dart) and Flutter version 3.32.8

❯ zed --version
Zed 0.198.5 – /usr/lib/zed/zed-editor

EDIT: Can confirm it does work with the correct adapter name 😅

[
  {
    "label": "Debug Flutter App",
    "adapter": "Dart",
    "type": "flutter",
    "program": "lib/main.dart",
    "args": ["--web-port=9090"]
  }
]

@Dixzz
Copy link
Author

Dixzz commented Aug 13, 2025

Thank you @vleeuwenmenno I've updated the same

@fstof
Copy link

fstof commented Aug 15, 2025

I can also confirm the capitalisation fixed it

Thanks

[EDIT]
I think the issue is the linter / schema specifies "dart" and warns when using "Dart" on the adapter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants