Skip to content

Visual Studio Code, rebuilt in Rust

Rust

perf(workbench): skip the bodies of collapsed Outline and Timeline panes

rokartur2bfcdc913103
diff --git a/native/crates/app/src/workbench/outline_pane.rs b/native/crates/app/src/workbench/outline_pane.rs
index 368607a601a..2b0bb4730c7 100644
--- a/native/crates/app/src/workbench/outline_pane.rs
+++ b/native/crates/app/src/workbench/outline_pane.rs
@@ -134,6 +134,10 @@ impl Workbench {
}
pub(super) fn outline_view_pane(&self, window: &Window, cx: &mut Context<Self>) -> super::view_panes::ViewPane {
+ // outlinePane.ts draws while its body is visible (`onDidChangeBodyVisibility`): a collapsed pane is its header.
+ if !self.is_view_visible(super::view_panes::OUTLINE_VIEW) {
+ return super::view_panes::ViewPane { id: super::view_panes::OUTLINE_VIEW, title: "Outline".into(), description: None, actions: None, draws_more: true, show_actions: false, body: div().into_any_element() };
+ }
let show_actions = self.outline_pane.focus.is_focused(window) || self.outline_pane.find.focus.is_focused(window);
super::view_panes::ViewPane { id: super::view_panes::OUTLINE_VIEW, title: "Outline".into(), description: None, actions: Some(self.outline_title_actions(window, cx).into_any_element()), draws_more: true, show_actions, body: self.outline_pane_body(window, cx) }
}
diff --git a/native/crates/app/src/workbench/timeline_view.rs b/native/crates/app/src/workbench/timeline_view.rs
index 3720a95ade8..30ac175a785 100644
--- a/native/crates/app/src/workbench/timeline_view.rs
+++ b/native/crates/app/src/workbench/timeline_view.rs
@@ -663,6 +663,11 @@ impl Workbench {
true if !label.is_empty() => format!("{label} (pinned)"),
_ => label,
};
+ // timelinePane.ts draws while its body is visible (`onDidChangeBodyVisibility`): a collapsed pane is its header.
+ if !self.is_view_visible(TIMELINE_VIEW_ID) {
+ let description = Some(description).filter(|description| !description.is_empty());
+ return super::view_panes::ViewPane { id: TIMELINE_VIEW_ID, title: "Timeline".into(), description, actions: None, draws_more: true, show_actions: false, body: div().into_any_element() };
+ }
let excluded = self.timeline_excluded_sources();
let local_history = self.setting("workbench.localHistory.enabled") == json!(true);
let message = model.message(&excluded, local_history, self.scm.model.providers.len());