# Fix debugger start ignoring save property \(\#53353\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/d06406f7d809a8f22dee3a947e1b18e3fca1d595)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: d06406f7d809a8f22dee3a947e1b18e3fca1d595

Requested commit: d06406f7d809a8f22dee3a947e1b18e3fca1d595

Commit: d06406f7d809a8f22dee3a947e1b18e3fca1d595

Tree: 7993a73b2df23f8b7915c09170ddfe27f010b166

Author: Om Chillure

Committer: GitHub

## Message

```
Fix debugger start ignoring save property (#53353)

## Summary

When `debugger::Start` runs a build task (via the `"build"` field in
`debug.json`), it was bypassing the task's `"save"` property and calling
`project.create_terminal_task()` directly. This meant unsaved files were
never saved before the build ran, even when `"save": "all"` was set
unlike `task: spawn` which correctly saved first.

**Changes:**
- Extracted `Workspace::save_for_task(workspace, strategy, cx)` as a
shared async helper in `workspace/src/tasks.rs`
- Refactored `schedule_resolved_task` to call this helper (no behavior
change, removes inline duplication)
- Called the same helper in `RunningState::resolve_scenario` before
`create_terminal_task`, so the debugger build path now respects the
task's `save` strategy
- Added `test_save_for_task_all`, `test_save_for_task_current`, and
`test_save_for_task_none` tests covering the extracted helper directly

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #53284

## Video after fix

[Screencast from 2026-04-08
08-04-18.webm](https://github.com/user-attachments/assets/b0c20164-3670-440a-b43a-8457fb57bfbd)



## Release Notes:

- Fixed debugger not saving files before running a build task when
`"save": "all"` is set in the task definition
```

## Parents

- [7ab425665d42f56aaaefcabf49b0d102c55ec767](https://git.cafe/gitcafe/zed/commit/7ab425665d42f56aaaefcabf49b0d102c55ec767?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/d06406f7d809a8f22dee3a947e1b18e3fca1d595?format=markdown)
