workspace: Prompt to save dirty buffers when close would orphan them (#55889)

The hot-exit shortcut in `save_all_internal` silently serializes dirty
buffers instead of prompting. It assumes the workspace will still be
reachable, but that's not true for `ReplaceWindow`, or for `CloseWindow`
of an empty workspace on macOS — both detach the workspace and orphan
its serialized buffers in the DB with no UI path back to them.

Only allow the shortcut when the workspace is actually recoverable
(`Quit`, `save_last_workspace`, or has visible worktrees). Otherwise
prompt.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] 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 #55726

Release Notes:

- Fixed unsaved untitled buffers being silently lost when opening a file
or project from an empty window
00d8d45685Agus Zubiaga committed on 5/6/2026, 3:14:25 PM· committed by GitHubparent7dc0226
2 files changedLine totals unavailable