-
Notifications
You must be signed in to change notification settings - Fork 6.3k
workspace: Persist window values without project #44785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
workspace: Persist window values without project #44785
Conversation
Persist and restore window values (size, position, etc.) to the KV Store when there are no projects open.
|
Here is a video of the window size and position persisting when File > New Window is chosen (so no project is selected). I have confirmed it also works on MacOS when you completely quit and reopen the app. Video demoDemo.window.size.and.position.persist.without.project.mp4 |
|
|
||
| /// Represents the status of how a window should be opened. | ||
| #[derive(Debug, Copy, Clone, PartialEq)] | ||
| #[derive(Debug, Copy, Clone, PartialEq, Deserialize, Serialize)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ConradIrwin I did have a question when you have time. I will also set up a time to pair. In my current version, I added Deserialize, Serialize to the WindowBounds enum.
Is there a better way for me to structure the feature so I can avoid changing WindowBounds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disadvantage of adding Serialize/Deserialize here is that we can never change this structure without breaking serialization. Although it's a bit of extra code (though hopefully nothing beyond what AI can build) it's less likely that we'll break things in the future if we have a specific structure/enum in the serialization code that gets converted to this (maybe we can copy the existing stuff from workspace? though tbh storing a JSON blob seems better than destructuring to a bunch of columns).
Not a huge issue though, so we could leave this and then deal with it when we want to change this enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to consider that, I have another version of the PR here #44937. I have run it and it also works.
I still have not tried for a remote workspace. Maybe I can try that tomorrow or later this week.
|
@mchisolm0 One question:
|
Switch remote workspace without a project to fallback to window bounds stored in the KV store like local workspaces now do.
| let (display, window_bounds) = DB.last_window().log_err()?; | ||
| Some((display?, window_bounds?)) | ||
| }); | ||
| .or_else(|| persistence::read_no_project_window_bounds()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ConradIrwin Is this where you meant by
instead of "last opened workspace"
I have not used opening remote workspaces yet, so I have not tested it beyond making sure Zed still builds.
Persist and restore window values (size, position, etc.) to the KV Store when there are no projects open.
Relates to Discussion #24228 (reply in thread)
Release Notes: