Skip to content

workspace: Reset all configured dock panels - #62552

Open
austincummings wants to merge 4 commits into
zed-industries:mainfrom
austincummings:fix-reset-dock-panel-sizes
Open

workspace: Reset all configured dock panels#62552
austincummings wants to merge 4 commits into
zed-industries:mainfrom
austincummings:fix-reset-dock-panel-sizes

Conversation

@austincummings

Copy link
Copy Markdown
Collaborator

Closes #57388.

When a dock is listed in resize_all_panels_in_dock, reset its compatible panels to the active panel's default size. This applies to the reset actions and resize-handle double-clicks. Docks not listed in the setting continue to reset only the active panel.

Adds regression coverage for fixed panels with different defaults, flexible panels, and active-panel-only resets.

Release Notes:

  • Fixed dock size reset commands only resetting the active panel when resize_all_panels_in_dock is enabled.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Aug 12, 2026
@zed-community-bot zed-community-bot Bot added the guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions label Aug 12, 2026
@dinocosta dinocosta added the area:ui/dock Feedback related to docks. There are 3 docks (left, right, and bottom). label Aug 14, 2026
@dinocosta dinocosta self-assigned this Aug 14, 2026

@dinocosta dinocosta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @austincummings ! 👋

Thank you for taking a stab at this. The overall approach seems good to me but I left some comments because I think some of the method names can be confusing for future readers.

Overall, I think the approach should be to have some "generic" names on the Dock's public methods, something like Dock::resize_panel_sizes Dock::reset_panel_sizes and then have some private helpers that either resize/reset only the active panel or all panels in the Dock.

Thanks!

Comment thread crates/workspace/src/dock.rs Outdated
Comment on lines +1079 to +1083
fn resizes_all_panels(&self, cx: &App) -> bool {
WorkspaceSettings::get_global(cx)
.resize_all_panels_in_dock
.contains(&self.position)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably rename this, as I got confused reviewing the code due to the fact that we now have both Dock::resizes_all_panels and Dock::resize_all_panels.

I'd suggest renaming to Dock::should_resize_all_panels 🙂

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed this to Dock::should_resize_all_panels to make the predicate distinct from Dock::resize_all_panels.

Comment thread crates/workspace/src/workspace.rs Outdated
Comment on lines +7698 to +7700
dock.update(cx, |dock, cx| {
dock.reset_active_panel_size(window, cx);
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found the Dock::reset_active_panel_size to be a bit confusing here, as it can also end up resetting the size for all panels in the dock. I believe that introducing a Dock::reset_panel_sizes method that simply checks whether all panels should be resized and the dispatched to either Dock::reset_all_panels_size or Dock::reset_active_panel_size might be easier to follow.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed resize_panels to resize_panel_sizes in 62a453d. I left the reset API unchanged for now so that naming change can be considered separately.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 6eb5570. Dock now exposes reset_panel_sizes, which dispatches to private reset_active_panel_size and reset_all_panel_sizes helpers. resize_active_panel is private as well, leaving resize_panel_sizes and reset_panel_sizes as the public operations.

Comment thread crates/workspace/src/workspace.rs Outdated
@@ -7695,32 +7695,20 @@ impl Workspace {
|workspace: &mut Workspace, _: &ResetActiveDockSize, window, cx| {
for dock in workspace.all_docks() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to these changes, but we can also update this to leverage Workspace::active_dock 👍

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 6eb5570. ResetActiveDockSize now uses Workspace::active_dock instead of searching all docks directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ui/dock Feedback related to docks. There are 3 docks (left, right, and bottom). cla-signed The user has signed the Contributor License Agreement guild Pull requests by someone in Zed Guild. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resize_all_panels_in_dock doesn't work for workspace::ResetOpenDocksSize and workspace::ResetActiveDocksSize

2 participants