mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-04 06:13:21 +01:00
## Summary Closes #50354 what happens is when a debug adapter returns an error whose message uses placeholders then zed showed the raw template e.g. `{response_message}` instead of the actual error. `process_response` in `crates/dap/src/transport.rs` only used `Message.format` and never looked at `Message.variables`. So, this adds a small `interpolate_message` helper that fills `{name}` placeholders from `variables` and unknown placeholders and unclosed braces are left as is which matches how vs code renders these messages. this supersedes #50982 which was closed due to stale CI and conflicts. This version only touches `transport.rs`. ## Testing here i added unit tests for `interpolate_message` like single/repeated placeholders, non string values, missing variables, no variables, unclosed braces and one test that goes through `process_response` end to end. and reproduced the bug on macOS with a tiny fake DAP adapter plugged in through the GDB adapter's `gdb_path` which gave: ```json [{ "label": "Repro #50354", "adapter": "GDB", "request": "launch", "program": "dummy", "gdb_path": "/path/to/fake_dap.py" }] ``` the adapter fails `launch` with `format: "{response_message}"` + a `variables` object as the same shape as probe-rs. and i couldn't do a full zed build on my machine due to disk issue, so I checked the fix by running the patched `process_response` on the exact response JSON: ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [ ] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed debugger error messages showing placeholders like `{response_message}` instead of the actual error text. --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Co-authored-by: Amp <amp@ampcode.com>