git_panel: Persist dock size (#32111)

Closes #32054

The dock size for the git panel wasn't being persisted across Zed
restarts. This was because the git panel lacked the serialization
pattern used by other panels.

Please let me know if you have any sort of feedback or anything, as i'm
still trying to learn :]

Release Notes:

- Fixed Git Panel dock size not being remembered across Zed restarts

## TODO
- [x] Update/fix tests that may be broken by the GitPanel constructor
changes
This commit is contained in:
vipex 2025-06-09 13:21:36 +02:00 committed by GitHub
parent 387281fa5b
commit 0cb7dd2972
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 175 additions and 148 deletions

View file

@ -472,6 +472,7 @@ fn initialize_panels(
let project_panel = ProjectPanel::load(workspace_handle.clone(), cx.clone());
let outline_panel = OutlinePanel::load(workspace_handle.clone(), cx.clone());
let terminal_panel = TerminalPanel::load(workspace_handle.clone(), cx.clone());
let git_panel = GitPanel::load(workspace_handle.clone(), cx.clone());
let channels_panel =
collab_ui::collab_panel::CollabPanel::load(workspace_handle.clone(), cx.clone());
let chat_panel =
@ -485,12 +486,14 @@ fn initialize_panels(
project_panel,
outline_panel,
terminal_panel,
git_panel,
channels_panel,
chat_panel,
notification_panel,
) = futures::try_join!(
project_panel,
outline_panel,
git_panel,
terminal_panel,
channels_panel,
chat_panel,
@ -501,6 +504,7 @@ fn initialize_panels(
workspace.add_panel(project_panel, window, cx);
workspace.add_panel(outline_panel, window, cx);
workspace.add_panel(terminal_panel, window, cx);
workspace.add_panel(git_panel, window, cx);
workspace.add_panel(channels_panel, window, cx);
workspace.add_panel(chat_panel, window, cx);
workspace.add_panel(notification_panel, window, cx);
@ -518,12 +522,6 @@ fn initialize_panels(
)
.detach()
});
let entity = cx.entity();
let project = workspace.project().clone();
let app_state = workspace.app_state().clone();
let git_panel = cx.new(|cx| GitPanel::new(entity, project, app_state, window, cx));
workspace.add_panel(git_panel, window, cx);
})?;
let is_assistant2_enabled = !cfg!(test);