workspace: Fix last removed folder from workspace used to reopen on Zed startup (#34925)

Closes #34924

Now, when `local_paths` are empty, we detach `session_id` from that
workspace serialization item. This way, when we restore it using the
default "last_session", we don't restore this workspace back. This is
same as when we use `cmd-w` to close window, which also sets
`session_id` to `None` before serialization.

Release Notes:

- Fixed an issue where last removed folder from workspace used to reopen
on Zed startup.
This commit is contained in:
Smit Barmase 2025-07-23 06:46:24 +05:30 committed by GitHub
parent 056003860a
commit e90cf0b941
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 61 additions and 34 deletions

View file

@ -1336,6 +1336,14 @@ impl WorkspaceDb {
}
}
query! {
pub(crate) async fn set_session_id(workspace_id: WorkspaceId, session_id: Option<String>) -> Result<()> {
UPDATE workspaces
SET session_id = ?2
WHERE workspace_id = ?1
}
}
pub async fn toolchain(
&self,
workspace_id: WorkspaceId,