Skip to content

Restore the focused workspace after quitting - #58392

Merged
Veykril merged 1 commit into
mainfrom
push-kmtxpmrzuqzo
Jun 5, 2026
Merged

Restore the focused workspace after quitting#58392
Veykril merged 1 commit into
mainfrom
push-kmtxpmrzuqzo

Conversation

@Veykril

@Veykril Veykril commented Jun 3, 2026

Copy link
Copy Markdown
Member

On quit, the handler activates every workspace in each window to surface save prompts. Activating re-serializes the multi-workspace state, so the persisted active_workspace_id ended up pointing at whichever workspace was iterated last rather than the one the user had focused. On the next launch the wrong (or empty) workspace was restored as active, even though all projects still appeared in Open Recent.

Re-activate the originally-focused workspace after the close-prompt loop (and on the cancel-quit path) so it is the one serialized as active. Also harden read_serialized_multi_workspaces to prefer a workspace with paths over a scratch/empty one when the persisted active workspace can't be matched.

Release Notes:

  • Fixed a workspace restoration issue where zed would restore a window with none of its projects opened by default

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jun 3, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Jun 3, 2026
@Veykril
Veykril requested a review from yara-blue June 5, 2026 07:33
Comment thread crates/zed/src/zed.rs
On quit, the handler activates every workspace in each window to surface save prompts. Activating re-serializes the multi-workspace state, so the persisted active_workspace_id ended up pointing at whichever workspace was iterated last rather than the one the user had focused. On the next launch the wrong (or empty) workspace was restored as active, even though all projects still appeared in Open Recent.

Re-activate the originally-focused workspace after the close-prompt loop (and on the cancel-quit path) so it is the one serialized as active. Also harden read_serialized_multi_workspaces to prefer a workspace with paths over a scratch/empty one when the persisted active workspace can't be matched.

Release Notes:

- Fixed the focused project not being restored when reopening a window
@Veykril
Veykril force-pushed the push-kmtxpmrzuqzo branch from 7e10fa6 to fea4362 Compare June 5, 2026 09:23
@Veykril
Veykril added this pull request to the merge queue Jun 5, 2026
Merged via the queue into main with commit 8b5db35 Jun 5, 2026
33 checks passed
@Veykril
Veykril deleted the push-kmtxpmrzuqzo branch June 5, 2026 10:47
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
On quit, the handler activates every workspace in each window to surface
save prompts. Activating re-serializes the multi-workspace state, so the
persisted active_workspace_id ended up pointing at whichever workspace
was iterated last rather than the one the user had focused. On the next
launch the wrong (or empty) workspace was restored as active, even
though all projects still appeared in Open Recent.

Re-activate the originally-focused workspace after the close-prompt loop
(and on the cancel-quit path) so it is the one serialized as active.
Also harden read_serialized_multi_workspaces to prefer a workspace with
paths over a scratch/empty one when the persisted active workspace can't
be matched.

Release Notes:

- Fixed a workspace restoration issue where zed would restore a window
with none of its projects opened by default
This was referenced Jun 18, 2026
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
On quit, the handler activates every workspace in each window to surface
save prompts. Activating re-serializes the multi-workspace state, so the
persisted active_workspace_id ended up pointing at whichever workspace
was iterated last rather than the one the user had focused. On the next
launch the wrong (or empty) workspace was restored as active, even
though all projects still appeared in Open Recent.

Re-activate the originally-focused workspace after the close-prompt loop
(and on the cancel-quit path) so it is the one serialized as active.
Also harden read_serialized_multi_workspaces to prefer a workspace with
paths over a scratch/empty one when the persisted active workspace can't
be matched.

Release Notes:

- Fixed a workspace restoration issue where zed would restore a window
with none of its projects opened by default
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
On quit, the handler activates every workspace in each window to surface
save prompts. Activating re-serializes the multi-workspace state, so the
persisted active_workspace_id ended up pointing at whichever workspace
was iterated last rather than the one the user had focused. On the next
launch the wrong (or empty) workspace was restored as active, even
though all projects still appeared in Open Recent.

Re-activate the originally-focused workspace after the close-prompt loop
(and on the cancel-quit path) so it is the one serialized as active.
Also harden read_serialized_multi_workspaces to prefer a workspace with
paths over a scratch/empty one when the persisted active workspace can't
be matched.

Release Notes:

- Fixed a workspace restoration issue where zed would restore a window
with none of its projects opened by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants