Visual Studio Code, rebuilt in Rust
Rust
fix(workbench): match upstream view drag feedback and side bar restore
rokartur7341cd0e6d7a
diff --git a/native/crates/app/src/theme.rs b/native/crates/app/src/theme.rsindex 8ebe068fe64..317d27ad20d 100644--- a/native/crates/app/src/theme.rs+++ b/native/crates/app/src/theme.rs@@ -617,6 +617,9 @@ fn registry_default(key: &str, kind: ThemeKind) -> ColorValue {"panelTitle.inactiveForeground" => (Transparent(&Key("panelTitle.activeForeground"), 0.6), Transparent(&Key("panelTitle.activeForeground"), 0.75), Hex("#FFFFFF")),"activityBarTop.foreground" => (Hex("#E7E7E7"), Hex("#424242"), Hex("#FFFFFF")),"activityBarTop.inactiveForeground" => (Transparent(&Key("activityBarTop.foreground"), 0.6), Transparent(&Key("activityBarTop.foreground"), 0.75), Hex("#FFFFFF")),+ "activityBarTop.dropBorder" => (Key("activityBarTop.foreground"), Key("activityBarTop.foreground"), Key("activityBarTop.foreground")),+ "activityBar.dropBorder" => (Key("activityBar.foreground"), Key("activityBar.foreground"), None),+ "panel.dropBorder" => (Key("panelTitle.activeForeground"), Key("panelTitle.activeForeground"), Key("panelTitle.activeForeground")),"window.activeBorder" => (None, None, Key("contrastBorder")),"titleBar.activeBackground" => (Hex("#3C3C3C"), Hex("#DDDDDD"), Hex("#000000")),"titleBar.activeForeground" => (Hex("#CCCCCC"), Hex("#333333"), Hex("#FFFFFF")),@@ -1037,6 +1040,8 @@ fn hc_light_default(key: &str) -> ColorValue {"panelTitle.inactiveForeground" => Key("editor.foreground"),"activityBarTop.foreground" => Key("editor.foreground"),"activityBarTop.inactiveForeground" => Key("editor.foreground"),+ "activityBarTop.dropBorder" => Key("activityBarTop.foreground"),+ "panel.dropBorder" => Key("panelTitle.activeForeground"),"window.activeBorder" => Key("contrastBorder"),"titleBar.activeBackground" => Hex("#FFFFFF"),"titleBar.activeForeground" => Hex("#292929"),diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex 76f5b5a81ed..779253f020a 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -1159,6 +1159,7 @@ impl Workbench {workbench.save_editor_part_state();workbench.persist_terminal_state();workbench.store_editor_resolver_cache();+ workbench.store_active_side_bar_container();async {}}).detach();@@ -1168,6 +1169,7 @@ impl Workbench {workbench.store_scm_view_state();workbench.store_editor_view_states();workbench.store_editor_resolver_cache();+ workbench.store_active_side_bar_container();}).detach();workbench.customize_theme();diff --git a/native/crates/app/src/workbench/activity_bar_menu.rs b/native/crates/app/src/workbench/activity_bar_menu.rsindex f75c38b8cd7..232bdfef943 100644--- a/native/crates/app/src/workbench/activity_bar_menu.rs+++ b/native/crates/app/src/workbench/activity_bar_menu.rs@@ -4,7 +4,7 @@use std::collections::HashMap;-use gpui::{App, AppContext, Bounds, Context, Div, InteractiveElement, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, SharedString, Stateful, StatefulInteractiveElement, Window, prelude::FluentBuilder};+use gpui::{App, AppContext, Bounds, Context, Div, DragMoveEvent, InteractiveElement, MouseButton, MouseDownEvent, ParentElement, Pixels, Point, SharedString, Stateful, StatefulInteractiveElement, Styled, Window, div, prelude::FluentBuilder, px};use serde_json::{Value, json};use super::Workbench;@@ -81,6 +81,10 @@ fn composite_container(item: &'static str) -> &'static str {if item == TESTING_ITEM { TESTING_CONTAINER } else { item }}+fn before_in(bar: &str, bounds: Bounds<Pixels>, pointer: Point<Pixels>) -> bool {+ if bar == "activity" { pointer.y <= bounds.center().y } else { pointer.x <= bounds.center().x }+}+fn composite_arg(args: &[Value]) -> Option<&'static str> {args.first().and_then(Value::as_str).map(super::tree_view::static_id)}@@ -163,15 +167,15 @@ impl Workbench {if before && from < to {to -= 1;}- if to >= ids.len() || to == from {- return;+ // compositeBar.ts `drop`: the composite opens focused even when the move leaves the order as it was.+ if to < ids.len() && to != from {+ ids.remove(from);+ ids.insert(to, id);+ // `CompositeBarModel.move`: a moved composite gets pinned.+ let mut unpinned = self.unpinned_containers(part);+ unpinned.retain(|other| other != id);+ self.save_bar_items(part, &ids, &unpinned);}- ids.remove(from);- ids.insert(to, id);- // `CompositeBarModel.move`: a moved composite gets pinned.- let mut unpinned = self.unpinned_containers(part);- unpinned.retain(|other| other != id);- self.save_bar_items(part, &ids, &unpinned);self.open_bar_composite(id, part, window, cx);self.focus_pane_composite(part, window, cx);}@@ -375,18 +379,83 @@ impl Workbench {}/// compositeBarActions.ts `onDrop` on an item: the composite goes before it when the pointer is in the item's first- /// half along the bar (`updateFromDragging`'s `preferTop` and `preferLeft`).+ /// half along the bar (`updateFromDragging`'s `preferTop` and `preferLeft`), where the insert line shows.pub(super) fn with_composite_drop(&self, item: Stateful<Div>, bar: &'static str, id: &'static str, part: Part, cx: &mut Context<Self>) -> Stateful<Div> {- item.on_drop(cx.listener(move |workbench, dragged: &DraggedComposite, window, cx| {+ let insert = self.panel.bar_insert.filter(|&(insert_bar, insert_id, _)| insert_bar == bar && insert_id == id && cx.has_active_drag());+ let line = insert.map(|(.., before)| self.bar_insert_line(bar, part, before));+ item.on_drag_move(cx.listener(move |workbench, event: &DragMoveEvent<DraggedComposite>, _, cx| {+ let over = event.bounds.contains(&event.event.position);+ workbench.track_delayed_drag_open(part, id, over, cx);+ // compositeBar.ts `canDrop`: a composite over its own item in its own bar has no feedback.+ let dragged = event.drag(cx).id;+ let accepts = workbench.container_location(dragged) != part || dragged != composite_container(id);+ workbench.track_bar_insert(bar, id, (over && accepts).then(|| before_in(bar, event.bounds, event.event.position)), cx);+ }))+ .on_drag_move(cx.listener(move |workbench, event: &DragMoveEvent<super::view_panes::DraggedPane>, _, cx| {+ let over = event.bounds.contains(&event.event.position);+ workbench.track_delayed_drag_open(part, id, over, cx);+ let accepts = workbench.can_move_view(event.drag(cx).id);+ workbench.track_bar_insert(bar, id, (over && accepts).then(|| before_in(bar, event.bounds, event.event.position)), cx);+ }))+ .on_drop(cx.listener(move |workbench, dragged: &DraggedComposite, window, cx| {cx.stop_propagation();+ workbench.panel.bar_insert = None;let before = workbench.drops_before(bar, id, window, cx);workbench.drop_composite(dragged.id, part, Some((id, before)), window, cx);})).on_drop(cx.listener(move |workbench, dragged: &super::view_panes::DraggedPane, window, cx| {cx.stop_propagation();+ workbench.panel.bar_insert = None;let before = workbench.drops_before(bar, id, window, cx);workbench.drop_view_on_location(dragged.id, part, Some((id, before)), cx);}))+ .children(line)+ }++ /// compositeBarActions.ts: a drag that stays over an unchecked item for 800ms runs it (dnd.ts `DelayedDragHandler`,+ /// cleared on `dragleave`, `drop` and `dragend`).+ fn track_delayed_drag_open(&mut self, part: Part, id: &'static str, over: bool, cx: &mut Context<Self>) {+ let pending = self.panel.delayed_drag_open.as_ref().map(|(pending, _)| *pending);+ if !over {+ if pending == Some(id) {+ self.panel.delayed_drag_open = None;+ }+ return;+ }+ if pending == Some(id) || self.bar_item_checked(part, id) {+ return;+ }+ let timer = cx.spawn(async move |workbench, cx| {+ cx.background_executor().timer(std::time::Duration::from_millis(800)).await;+ let _ = workbench.update(cx, |workbench, cx| {+ workbench.panel.delayed_drag_open = None;+ if cx.has_active_drag() {+ workbench.open_bar_item(part, id, cx);+ }+ });+ });+ self.panel.delayed_drag_open = Some((id, timer));+ }++ fn bar_item_checked(&self, part: Part, id: &'static str) -> bool {+ if !self.is_part_visible(part) {+ return false;+ }+ match part {+ Part::SideBar => self.compact_activity_view(id) == self.side_bar_view,+ _ => self.active_container_in(part) == Some(id),+ }+ }++ fn open_bar_item(&mut self, part: Part, id: &'static str, cx: &mut Context<Self>) {+ match part {+ Part::SideBar => {+ self.side_bar_view = self.compact_activity_view(id);+ self.set_part_hidden(Part::SideBar, false, cx);+ }+ _ => self.show_view_container(id, cx),+ }+ cx.notify();}/// compositeBar.ts `CompositeBarDndCallbacks.onDrop`: a composite or a view dropped on `part`'s bar past its items@@ -409,9 +478,36 @@ impl Workbench {/// Whether the pointer is in the first half of `bar`'s item `id`; the activity bar is the one vertical bar.fn drops_before(&self, bar: &'static str, id: &'static str, window: &Window, cx: &App) -> bool {- let bounds = self.drawn_action_bar_item_bounds(bar, id, cx);- let pointer = window.mouse_position();- if bar == "activity" { pointer.y <= bounds.center().y } else { pointer.x <= bounds.center().x }+ before_in(bar, self.drawn_action_bar_item_bounds(bar, id, cx), window.mouse_position())+ }++ /// Sets the insert line of `bar`'s item `id` (`before` it, or after), or clears it when the drag left that item.+ fn track_bar_insert(&mut self, bar: &'static str, id: &'static str, before: Option<bool>, cx: &mut Context<Self>) {+ let insert = match before {+ Some(before) => Some((bar, id, before)),+ None if self.panel.bar_insert.is_some_and(|(insert_bar, insert_id, _)| insert_bar == bar && insert_id == id) => None,+ None => return,+ };+ if self.panel.bar_insert != insert {+ self.panel.bar_insert = insert;+ cx.notify();+ }+ }++ /// paneCompositePart.css: a 2x24px `--insert-border-color` line at the item's side; activityaction.css: a 2px one+ /// across the vertical activity bar's item at its top or bottom.+ fn bar_insert_line(&self, bar: &'static str, part: Part, before: bool) -> Div {+ let color = match part {+ _ if bar == "activity" => "activityBar.dropBorder",+ Part::Panel => "panel.dropBorder",+ Part::AuxiliaryBar if self.icon_composite_bar(part).is_none() => "panel.dropBorder",+ _ => "activityBarTop.dropBorder",+ };+ let line = div().absolute().bg(self.color(color)).debug_selector(move || format!("bar-insert-{}", if before { "before" } else { "after" }));+ if bar == "activity" {+ return line.left_0().right_0().h(px(2.)).when(before, |line| line.top_0()).when(!before, |line| line.bottom_0());+ }+ line.top(gpui::relative(0.5)).mt(px(-12.)).w(px(2.)).h(px(24.)).when(before, |line| line.left(px(-1.))).when(!before, |line| line.right(px(-1.)))}/// paneCompositeBar.ts: a container at its default location with one view whose default container is anotherdiff --git a/native/crates/app/src/workbench/panel.rs b/native/crates/app/src/workbench/panel.rsindex f47b66269fc..2015164e699 100644--- a/native/crates/app/src/workbench/panel.rs+++ b/native/crates/app/src/workbench/panel.rs@@ -85,6 +85,10 @@ pub(super) struct Panel {auxiliary_bar: CompositeBar,/// The part a dragged view container is over (`CompositeDragAndDropObserver` `onDragEnter`).pub(super) drop_target: Option<Part>,+ /// The bar item a drag has been over since the timer started (dnd.ts `DelayedDragHandler`).+ pub(super) delayed_drag_open: Option<(&'static str, gpui::Task<()>)>,+ /// The bar and item a drag can drop on, and whether before it: compositeBarActions.ts `updateFromDragging`.+ pub(super) bar_insert: Option<(&'static str, &'static str, bool)>,}/// A part title's action bars (actionbar.ts), one tab stop each: the composite bar's tabs and the global actions.@@ -421,11 +425,15 @@ impl Workbench {}/// The secondary side bar card: `MenuId.AuxiliaryBarTitle`'s Toggle Maximized Secondary Side Bar (toggled: the- /// other tooltip and the toolbar's `highlightToggledItems` background), then Hide Secondary Side Bar.+ /// other tooltip and the toolbar's `highlightToggledItems` background), then Hide Secondary Side Bar while+ /// `workbench.activityBar.location` is `default`.pub(super) fn auxiliary_bar_part(&mut self, window: &mut Window, cx: &mut Context<Self>) -> Div {let maximized = self.is_auxiliary_bar_maximized();let maximize_title = if maximized { "Restore Secondary Side Bar" } else { "Maximize Secondary Side Bar" };- let actions = vec![("screen-full", maximize_title, "workbench.action.toggleMaximizedAuxiliaryBar", maximized), ("close", "Hide Secondary Side Bar", "workbench.action.closeAuxiliaryBar", false)];+ let mut actions = vec![("screen-full", maximize_title, "workbench.action.toggleMaximizedAuxiliaryBar", maximized)];+ if self.setting("workbench.activityBar.location") == "default" {+ actions.push(("close", "Hide Secondary Side Bar", "workbench.action.closeAuxiliaryBar", false));+ }self.pane_composite_part(Part::AuxiliaryBar, actions, window, cx)}@@ -441,13 +449,18 @@ impl Workbench {let mut tabs: Vec<AnyElement> = Vec::new();let mut overflowing = Vec::new();let mut previous_inactive = false;+ let icon_bar = self.icon_composite_bar(part);for tab in self.part_tabs(part) {match shown.contains(&tab.id) {true => {let checked = Some(tab.id) == active;let divider = previous_inactive && !checked;previous_inactive = !checked;- let item = self.action_bar_item(tabs_bar, tab.id, self.panel_tab(&tab, checked, tabs.is_empty(), divider, background, window, cx), cx);+ let tab_element = match icon_bar {+ Some(footer) => self.icon_composite_tab(&tab, checked, tabs.is_empty(), footer, window, cx),+ None => self.panel_tab(&tab, checked, tabs.is_empty(), divider, background, window, cx),+ };+ let item = self.action_bar_item(tabs_bar, tab.id, tab_element, cx);let item = self.with_composite_menu(item, tabs_bar, tab.id, part, cx);tabs.push(self.with_composite_drop(item, tabs_bar, tab.id, part, cx).into_any_element());}@@ -470,7 +483,8 @@ impl Workbench {});let progress_bars = active.into_iter().chain(merged_view).filter_map(|scope| self.scoped_progress_bar(scope)).map(|bar| bar.top(px(-2.)));let view_actions = merged_view.or(active).zip(view_actions);- self.pane_composite_card(part, background)+ let content = div().relative().flex_1().min_h_0().flex().flex_col().child(size_tracker(content_bounds)).child(content).children(progress_bars);+ let card = self.pane_composite_card(part, background).on_drag_move(cx.listener(move |workbench, event: &DragMoveEvent<DraggedComposite>, _, cx| {workbench.track_part_drop_target(part, event.bounds.contains(&event.event.position), cx);}))@@ -486,9 +500,88 @@ impl Workbench {.on_drop(cx.listener(move |workbench, dragged: &super::view_panes::DraggedPane, _, cx| {workbench.panel.drop_target = None;workbench.drop_view_on_location(dragged.id, part, None, cx);+ }));+ let Some(footer) = icon_bar else {+ return card.child(self.with_bar_end_drop(self.pane_composite_title(part, tabs, view_actions, actions, drop_feedback, cx), part, cx)).child(content);+ };+ let strip = self.with_bar_end_drop(self.icon_composite_strip(part, tabs, footer, cx), part, cx);+ let label = active.and_then(|container| self.part_tabs(part).into_iter().find(|tab| tab.id == container)).map(|tab| self.view_header_text(tab.title, false));+ let title = self.icon_bar_title(part, label, view_actions, actions, drop_feedback, cx);+ match footer {+ false => card.child(strip).child(title).child(content),+ true => card.child(title).child(content).child(strip),+ }+ }++ /// auxiliaryBarPart.ts `resolveConfiguration`: with the activity bar on top or at the bottom the secondary side bar+ /// cannot show labels; its composite bar is a header (`false`) or a footer (`true`) of icons.+ pub(super) fn icon_composite_bar(&self, part: Part) -> Option<bool> {+ if part != Part::AuxiliaryBar {+ return None;+ }+ self.compact_activity_bar_location()+ }++ /// The header or footer composite bar: the side bar's compact activity bar strip with the part's icon tabs.+ fn icon_composite_strip(&self, part: Part, tabs: Vec<AnyElement>, footer: bool, cx: &mut Context<Self>) -> Div {+ let line = div().absolute().left_0().right_0().h(px(1.)).bg(self.connected_pane_tab_border());+ let line = if footer { line.top_0() } else { line.bottom_0() };+ let strip = div()+ .relative()+ .h(px(TITLE_HEIGHT))+ .flex_none()+ .flex()+ .bg(self.tab_strip_background())+ .on_mouse_down(MouseButton::Right, cx.listener(move |workbench, event: &MouseDownEvent, window, cx| workbench.show_bar_context_menu(part, event.position, window, cx)))+ .child(line)+ .child(size_tracker(self.composite_bar(part).title_bounds.clone()));+ self.action_bar(title_bars(part)[0], false, strip, cx).children(tabs)+ }++ /// compositeBarActions.ts `CompositeBarActionViewItem` with `icon: true`: the container's 16px icon in a 36px item,+ /// colored as the activity bar on top (`activityBarTop.*`).+ fn icon_composite_tab(&self, tab: &CompositeTab, active: bool, first: bool, footer: bool, window: &Window, cx: &mut Context<Self>) -> Stateful<Div> {+ let id = tab.id;+ let color = if active { self.color("activityBarTop.foreground") } else { self.color("activityBarTop.inactiveForeground") };+ let hover_color = if active { color } else { self.foreground_or("modernTab.hoverForeground") };+ let hover_group = SharedString::from(super::ACTIVITY_ITEM_GROUP);+ let dragged = DraggedComposite { id, label: tab.title.into(), icon: Some(self.compact_activity_drag_icon(id)), foreground: color, background: self.color("sideBar.background") };+ div()+ .id(id)+ .debug_selector(move || id.to_owned())+ .relative()+ .h(px(TITLE_HEIGHT))+ .w(px(ICON_TAB_WIDTH))+ .flex_none()+ .cursor_pointer()+ .group(hover_group.clone())+ .when(active, |item| item.child(self.connected_pane_tab_fill(first, footer, "sideBar.background")))+ .when(!active, |item| item.child(self.inactive_pane_tab_hover(&hover_group, true)))+ .child(self.compact_activity_icon(id, color, hover_color).h(px(TITLE_HEIGHT)))+ .child(self.panel_tab_hover(tab, window))+ .on_drag(dragged, |dragged, _, _, cx| cx.new(|_| dragged.clone()))+ .on_click(cx.listener(move |workbench, _, window, cx| match workbench.panel.views.iter().find(|view| view.id == id) {+ Some(view) => (view.open)(workbench, window, cx),+ None => workbench.show_view_container(id, cx),}))- .child(self.with_bar_end_drop(self.pane_composite_title(part, tabs, view_actions, actions, drop_feedback, cx), part, cx))- .child(div().relative().flex_1().min_h_0().flex().flex_col().child(size_tracker(content_bounds)).child(content).children(progress_bars))+ }++ /// compositePart.ts title area under a header composite bar: the active container's title label, as the side+ /// bar's, and the title actions.+ fn icon_bar_title(&self, part: Part, label: Option<String>, view_actions: Option<(&'static str, AnyElement)>, actions: Vec<GlobalAction>, drop_feedback: bool, cx: &mut Context<Self>) -> Div {+ let background = if drop_feedback { self.color("editorGroup.dropBackground") } else { self.color("sideBar.background") };+ let label = label.map(|label| div().min_w_0().truncate().pl(px(8.)).line_height(px(TITLE_HEIGHT)).text_size(px(12.)).font_weight(gpui::FontWeight::SEMIBOLD).text_color(self.foreground_or("sideBarTitle.foreground")).child(label));+ div()+ .relative()+ .h(px(TITLE_HEIGHT))+ .flex_none()+ .flex()+ .items_center()+ .px(px(4.))+ .bg(background)+ .debug_selector(|| "pane-composite-title".into())+ .children(label)+ .child(self.pane_composite_actions(part, view_actions, actions, cx))}/// The container's content and title actions: a single view merged into it (its body, its actions in the@@ -553,8 +646,7 @@ impl Workbench {/// `.composite.title`: the tab strip's background with its bottom line, tabs on the left, then the active view's/// title actions, a separator (actionbar.css `.separator`) and the global actions on the right: three tab stops.fn pane_composite_title(&self, part: Part, tabs: Vec<AnyElement>, view_actions: Option<(&'static str, AnyElement)>, actions: Vec<GlobalAction>, drop_feedback: bool, cx: &mut Context<Self>) -> Div {- let [tabs_bar, global_bar] = title_bars(part);- let foreground = self.color("icon.foreground");+ let tabs_bar = title_bars(part)[0];let bottom_line = div().absolute().bottom_0().left_0().right_0().h(px(1.)).bg(self.connected_pane_tab_border());let bar = self.composite_bar(part);let background = if drop_feedback { self.color("editorGroup.dropBackground") } else { self.tab_strip_background() };@@ -573,19 +665,27 @@ impl Workbench {.child(bottom_line).child(size_tracker(bar.title_bounds.clone())).child(self.action_bar(tabs_bar, false, div().h_full().flex().children(tabs), cx))- // The actions keep their width: the tab layout measures them, so they must not shrink for tabs that overflow.- .child(div().relative().flex_none().ml_auto().h_full().flex().items_center().gap(px(4.)).child(size_tracker(bar.actions_bounds.clone())).when_some(view_actions, |bar, (view, view_actions)| {+ .child(self.pane_composite_actions(part, view_actions, actions, cx))+ }++ /// The active view's title actions, a separator (actionbar.css `.separator`) and the part's global actions.+ fn pane_composite_actions(&self, part: Part, view_actions: Option<(&'static str, AnyElement)>, actions: Vec<GlobalAction>, cx: &mut Context<Self>) -> Div {+ let global_bar = title_bars(part)[1];+ let foreground = self.color("icon.foreground");+ let bar = self.composite_bar(part);+ // The actions keep their width: the tab layout measures them, so they must not shrink for tabs that overflow.+ div().relative().flex_none().ml_auto().h_full().flex().items_center().gap(px(4.)).child(size_tracker(bar.actions_bounds.clone())).when_some(view_actions, |bar, (view, view_actions)| {// The bar's 4px gap is the separator's right margin.bar.child(self.action_bar(view, false, div().flex().items_center().child(view_actions), cx)).child(div().w(px(1.)).h(px(16.)).ml(px(4.)).bg(self.color("disabledForeground")))}).child(self.action_bar(global_bar, false, div().flex().items_center().gap(px(4.)).children(actions.into_iter().map(|(icon, title, command, toggled)| {let toggled_background = self.theme.color("actionBar.toggledBackground").unwrap_or(self.color("inputOption.activeBackground"));- let action = self.icon(icon, 22., 16., foreground).id(command).rounded(px(4.)).cursor_pointer().when(toggled, |action| action.bg(toggled_background)).child(self.action_hover(title, command, HoverOptions::managed())).on_click(cx.listener(+ let action = self.icon(icon, 22., 16., foreground).id(command).debug_selector(move || command.to_owned()).rounded(px(4.)).cursor_pointer().when(toggled, |action| action.bg(toggled_background)).child(self.action_hover(title, command, HoverOptions::managed())).on_click(cx.listener(move |workbench, _, window, cx| {workbench.execute_command(command, Vec::new(), window, cx);},));self.action_bar_item(global_bar, command, action, cx)- })), cx)))+ })), cx))}/// A composite bar tab (`.action-item` with 16px padding); the checked one is the part's own fill, connected to@@ -742,12 +842,18 @@ impl Workbench {/// (a started terminal's actions); not when they shrink, as the reference (View as Table drops Collapse All without/// bringing Terminal back).fn tabs_that_fit(&self, part: Part, active: Option<&'static str>, window: &Window) -> Vec<&'static str> {- let tabs: Vec<(&'static str, f32)> = self.part_tabs(part).into_iter().map(|view| (view.id, panel_tab_width(&view, self, window))).collect();+ let icon_bar = self.icon_composite_bar(part).is_some();+ let tabs: Vec<(&'static str, f32)> = self.part_tabs(part).into_iter().map(|view| (view.id, if icon_bar { ICON_TAB_WIDTH } else { panel_tab_width(&view, self, window) })).collect();let bar = self.composite_bar(part);let title = bar.title_bounds.get().size.width;if title <= px(0.) {return tabs.into_iter().map(|(id, _)| id).collect();}+ // paneCompositePart.ts `layoutCompositeBar` outside the title: 8px padding and the part's 1px border, no+ // toolbars; auxiliaryBarPart.ts `overflowActionSize` 30.+ if icon_bar {+ return fitting_tabs(&tabs, active, (f32::from(title) - 9.).max(MIN_COMPOSITE_BAR_WIDTH), 30.);+ }// paneCompositePart.ts `layoutCompositeBar`: 16px title padding, the toolbars and their 8px padding. The filter// box counts at its 200px resting width: the reference lays the tabs out on resize, not when the box grows on focus.let filter = f32::from(bar.filter_bounds.replace(Bounds::default()).size.width);diff --git a/native/crates/app/src/workbench/quick_open.rs b/native/crates/app/src/workbench/quick_open.rsindex e3b2d2321a5..5bd6f71fba3 100644--- a/native/crates/app/src/workbench/quick_open.rs+++ b/native/crates/app/src/workbench/quick_open.rs@@ -51,6 +51,7 @@ impl Workbench {pub fn restore_workspace_state(&mut self, storage: Arc<Mutex<Storage>>) {self.workspace_storage = storage;self.reset_part_grid();+ self.restore_active_side_bar_container();let stored = self.workspace_storage.lock().unwrap().get(HISTORY_STORAGE_KEY).map(str::to_owned);let excluded = self.history_exclude_matcher();self.quick_access.editor_history = EditorHistory::load(stored.as_deref(), |path| !excluded(path, None));diff --git a/native/crates/app/src/workbench/side_bar.rs b/native/crates/app/src/workbench/side_bar.rsindex a34b7047f0e..94c3c071300 100644--- a/native/crates/app/src/workbench/side_bar.rs+++ b/native/crates/app/src/workbench/side_bar.rs@@ -94,7 +94,7 @@ impl Workbench {}/// `compact_activity_icon`'s glyph as a drag image.- fn compact_activity_drag_icon(&self, container: &'static str) -> SharedString {+ pub(super) fn compact_activity_drag_icon(&self, container: &'static str) -> SharedString {if let Some((_, icon, ..)) = VIEW_CONTAINERS.into_iter().find(|(_, _, _, command, _)| *command == container) {return self.codicon_svg(icon);}@@ -104,12 +104,20 @@ impl Workbench {ContainerIcon::Codicon(name) => self.codicon_svg(name),ContainerIcon::File(path) => path.to_string_lossy().into_owned().into(),},- _ => self.codicon_svg(self.generated_container_view(container).expect("a container with a view").icon),+ _ => self.codicon_svg(self.container_codicon(container)),+ }+ }++ /// viewPane.ts `getIcon` of a panel container's or a generated container's first view.+ fn container_codicon(&self, container: &str) -> &'static str {+ match self.panel.views.iter().find(|view| view.id == container) {+ Some(view) => self.view_container_icon(view.view_id),+ None => self.generated_container_view(container).expect("a container with a view").icon,}}/// The side bar view an `activity_bar_containers` entry opens.- fn compact_activity_view(&self, container: &'static str) -> SideBarView {+ pub(super) fn compact_activity_view(&self, container: &'static str) -> SideBarView {if let Some((.., view)) = VIEW_CONTAINERS.into_iter().find(|(_, _, _, command, _)| *command == container) {return view.expect("a built-in container opens a view");}@@ -122,7 +130,7 @@ impl Workbench {/// An `activity_bar_containers` entry's 16px icon: the compact bar's codicon of a built-in container, else the/// icon its activity bar item shows; `hover` while its item is hovered.- fn compact_activity_icon(&self, container: &'static str, color: Rgba, hover: Rgba) -> Div {+ pub(super) fn compact_activity_icon(&self, container: &'static str, color: Rgba, hover: Rgba) -> Div {let style = move |icon: gpui::Svg| icon.text_color(color).group_hover(super::ACTIVITY_ITEM_GROUP, move |icon| icon.text_color(hover));if let Some((_, icon, ..)) = VIEW_CONTAINERS.into_iter().find(|(_, _, _, command, _)| *command == container) {return self.styled_icon(icon, 36., 16., style);@@ -133,7 +141,7 @@ impl Workbench {ContainerIcon::Codicon(name) => self.styled_icon(name, 36., 16., style),ContainerIcon::File(path) => div().debug_selector(move || format!("uri-icon-{id}")).size(px(36.)).flex_none().flex().items_center().justify_center().child(style(svg().external_path(path.to_string_lossy().into_owned()).size(px(16.)))),},- _ => self.styled_icon(self.generated_container_view(container).expect("a container with a view").icon, 36., 16., style),+ _ => self.styled_icon(self.container_codicon(container), 36., 16., style),}}diff --git a/native/crates/app/src/workbench/view_locations.rs b/native/crates/app/src/workbench/view_locations.rsindex 300c9bfc1ab..3a02dcb5aae 100644--- a/native/crates/app/src/workbench/view_locations.rs+++ b/native/crates/app/src/workbench/view_locations.rs@@ -29,6 +29,8 @@ pub(super) const SEARCH_VIEW: &str = "workbench.view.search";pub(super) const TESTING_CONTAINER: &str = "workbench.view.extension.test";/// The built-in side bar containers views move between, as Move View lists them.const SIDE_BAR_CONTAINERS: [&str; 4] = [EXPLORER_CONTAINER, SEARCH_CONTAINER, SCM_CONTAINER, DEBUG_CONTAINER];+/// sidebarPart.ts `activeViewletSettingsKey`, in workspace storage.+const ACTIVE_VIEWLET_KEY: &str = "workbench.sidebar.activeviewletid";/// viewDescriptorService.ts `COMMON_CONTAINER_ID_PREFIX`.const GENERATED_PREFIX: &str = "workbench.views.service";@@ -341,6 +343,27 @@ impl Workbench {self.side_bar_view = self.containers_in(Part::SideBar).first().map_or(SideBarView::Extensions, |container| side_bar_view_of(container));}+ /// compositePart.ts `activeCompositeSettingsKey` of the side bar: the active container, removed when it is the+ /// default one. Upstream stores on each open; the port's caller runs it when the window closes or the app quits.+ pub(super) fn store_active_side_bar_container(&self) {+ let container = if self.side_bar_view == SideBarView::Extensions { Some(super::extensions_view::VIEWLET_ID) } else { self.side_bar_container() };+ let mut storage = self.workspace_storage.lock().unwrap();+ match container {+ Some(container) if container != EXPLORER_CONTAINER => storage.set(ACTIVE_VIEWLET_KEY, container.to_owned()),+ _ => storage.delete(ACTIVE_VIEWLET_KEY),+ }+ }++ /// layout.ts `restoreParts`: the side bar opens the stored container while it is still there.+ pub(super) fn restore_active_side_bar_container(&mut self) {+ let stored = self.workspace_storage.lock().unwrap().get(ACTIVE_VIEWLET_KEY).map(str::to_owned);+ let mut containers = self.containers_in(Part::SideBar);+ containers.push(super::extensions_view::VIEWLET_ID);+ if let Some(restored) = containers.into_iter().find(|id| Some(*id) == stored.as_deref() && self.container_location(id) == Part::SideBar) {+ self.side_bar_view = side_bar_view_of(restored);+ }+ }+/// `viewsService.isViewVisible` of a movable view: its container shows and the view's pane is expanded.pub(super) fn is_view_visible(&self, id: &str) -> bool {let Some(view) = self.movable_view(id) else { return false };@@ -552,6 +575,19 @@ impl Workbench {}}+ /// viewPane.ts `calculateTitle`: a view away from its default container is titled after that container too.+ pub(super) fn moved_view_title(&self, id: &str, title: String) -> String {+ let Some(view) = self.movable_view(id) else {+ return title;+ };+ let current = self.view_container(&view);+ let container_title = self.container_title(view.default_container);+ if current == view.default_container || container_title == self.container_title(current) || title == container_title {+ return title;+ }+ format!("{container_title}: {title}")+ }+/// MoveViewAction `getView`: the movable views grouped by container, the first one active (upstream selects the/// focused one, which a single-select pick does not show).fn pick_view_to_move(&mut self, window: &mut Window, cx: &mut Context<Self>) {diff --git a/native/crates/app/src/workbench/view_locations/tests.rs b/native/crates/app/src/workbench/view_locations/tests.rsindex 25745ff441a..3ae4d66b591 100644--- a/native/crates/app/src/workbench/view_locations/tests.rs+++ b/native/crates/app/src/workbench/view_locations/tests.rs@@ -607,4 +607,130 @@ fn a_header_dropped_on_a_panel_view_shown_alone_moves_into_its_container(cx: &muworkbench.update(cx, |workbench, cx| workbench.drop_pane_from_container(OUTLINE_VIEW, pane_container(output), output, false, cx));cx.run_until_parked();assert!(workbench.read_with(cx, |workbench, _| workbench.view_container(&workbench.movable_view(OUTLINE_VIEW).unwrap()) == output));+ workbench.update(cx, |workbench, cx| workbench.show_view_container(output, cx));+ cx.update(|window, cx| drop(window.draw(cx)));+ let panes = workbench.read_with(cx, |workbench, _| workbench.panes(pane_container(output)).view.as_ref().unwrap().ids().to_vec());+ assert_eq!(panes.first(), Some(&OUTLINE_VIEW), "dropped on the view's first half: {panes:?}");+}++#[gpui::test]+fn a_container_dropped_on_a_pane_puts_its_first_active_view_there(cx: &mut TestAppContext) {+ let (workbench, cx) = open(Arc::new(Mutex::new(Storage::in_memory())), cx);+ let output = crate::workbench::output_view::OUTPUT_VIEW_ID;+ // Without a repository the hidden Repositories view is inactive (`scm.providerCount`), so Changes is the anchor.+ workbench.update(cx, |workbench, cx| workbench.merge_container_into(SCM_CONTAINER, pane_container(output), Some((output, false)), cx));+ workbench.update(cx, |workbench, cx| workbench.show_view_container(output, cx));+ cx.update(|window, cx| drop(window.draw(cx)));+ let panes = workbench.read_with(cx, |workbench, _| workbench.panes(pane_container(output)).view.as_ref().unwrap().ids().to_vec());+ assert_eq!(panes, [crate::workbench::view_panes::SCM_CHANGES_VIEW, output]);+ // viewPane.ts `calculateTitle`: the moved view's header names its default container.+ let titles = workbench.read_with(cx, |workbench, _| [workbench.moved_view_title(crate::workbench::view_panes::SCM_CHANGES_VIEW, "Changes".into()), workbench.moved_view_title(output, "Output".into())]);+ assert_eq!(titles, ["Source Control: Changes", "Output"]);+ // paneview.css `.actions { display: none }`: the Output actions leave the title its room until hovered.+ let actions = format!("pane-actions-{output}").leak();+ assert!(cx.debug_bounds(actions).is_none());+ let header = cx.debug_bounds(format!("pane-header-{output}").leak()).unwrap().center();+ cx.simulate_mouse_move(header, None, gpui::Modifiers::none());+ assert!(cx.debug_bounds(actions).is_some());+}++#[gpui::test]+fn a_pane_drop_overlay_goes_when_the_drag_leaves_the_pane(cx: &mut TestAppContext) {+ let (workbench, cx) = open(Arc::new(Mutex::new(Storage::in_memory())), cx);+ let header = cx.debug_bounds("pane-header-outline").unwrap().center();+ let timeline = cx.debug_bounds("pane-header-timeline").unwrap().center();+ cx.simulate_mouse_down(header, gpui::MouseButton::Left, gpui::Modifiers::none());+ cx.simulate_mouse_move(header + gpui::point(gpui::px(10.), gpui::px(0.)), gpui::MouseButton::Left, gpui::Modifiers::none());+ cx.simulate_mouse_move(timeline, gpui::MouseButton::Left, gpui::Modifiers::none());+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.panes(PaneContainer::Explorer).drop.map(|(id, _)| id)), Some(TIMELINE_VIEW));+ cx.simulate_mouse_move(gpui::point(gpui::px(600.), timeline.y), gpui::MouseButton::Left, gpui::Modifiers::none());+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.panes(PaneContainer::Explorer).drop), None);+ cx.simulate_mouse_up(gpui::point(gpui::px(600.), timeline.y), gpui::MouseButton::Left, gpui::Modifiers::none());+}++#[gpui::test]+fn the_active_side_bar_container_is_restored_while_it_stays_in_the_side_bar(cx: &mut TestAppContext) {+ let (workbench, cx) = open(Arc::new(Mutex::new(Storage::in_memory())), cx);+ workbench.update(cx, |workbench, cx| workbench.drop_view_on_location(OUTLINE_VIEW, Part::SideBar, None, cx));+ cx.run_until_parked();+ let restart = |workbench: &mut Workbench| {+ workbench.store_active_side_bar_container();+ workbench.side_bar_view = SideBarView::Search;+ workbench.restore_workspace_state(workbench.workspace_storage.clone());+ workbench.side_bar_view+ };+ let container = workbench.read_with(cx, |workbench, _| workbench.view_container(&workbench.movable_view(OUTLINE_VIEW).unwrap()));+ assert_eq!(workbench.update(cx, |workbench, _| restart(workbench)), SideBarView::Generated(container));+ workbench.update_in(cx, |workbench, window, cx| workbench.drop_composite(container, Part::Panel, None, window, cx));+ let restored = workbench.update(cx, |workbench, _| {+ workbench.restore_workspace_state(workbench.workspace_storage.clone());+ workbench.side_bar_view+ });+ assert_eq!(restored, SideBarView::Explorer);+ assert!(workbench.read_with(cx, |workbench, _| workbench.workspace_storage.lock().unwrap().get(ACTIVE_VIEWLET_KEY).is_some()));+}++/// auxiliaryBarPart.ts `resolveConfiguration`: with the activity bar on top the secondary side bar cannot show labels,+/// so its composite bar is a header of 36x32 icon items over a title row without Hide Secondary Side Bar.+#[gpui::test]+fn the_secondary_side_bar_shows_icons_over_a_title_with_the_activity_bar_on_top(cx: &mut TestAppContext) {+ let (workbench, cx) = open(Arc::new(Mutex::new(Storage::in_memory())), cx);+ let dir = std::env::temp_dir().join(format!("vsrustium-{}-{}", crate::test_name(), std::process::id()));+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.settings = Arc::new(Mutex::new(config::service::Settings::load(config::registry::Registry::with_extensions(&[]), dir.join("User"), None)));+ workbench.update_setting("workbench.activityBar.location", json!("top"));+ workbench.drop_composite(MARKERS_CONTAINER_ID, Part::AuxiliaryBar, None, window, cx);+ workbench.set_part_hidden(Part::AuxiliaryBar, false, cx);+ });+ cx.update(|window, cx| drop(window.draw(cx)));+ cx.update(|window, cx| drop(window.draw(cx)));+ let tab = cx.debug_bounds(MARKERS_CONTAINER_ID).unwrap();+ assert_eq!(tab.size, gpui::size(gpui::px(36.), gpui::px(32.)));+ assert_eq!(cx.debug_bounds("pane-composite-title").unwrap().origin.y, tab.bottom(), "the title row under the icons");+ assert!(cx.debug_bounds("workbench.action.toggleMaximizedAuxiliaryBar").is_some());+ assert!(cx.debug_bounds("workbench.action.closeAuxiliaryBar").is_none(), "Hide shows only with the default location");+}++/// compositeBarActions.ts `DelayedDragHandler`: a header held over an unchecked activity item for 800ms opens it.+#[gpui::test]+fn a_header_held_over_an_activity_item_opens_it_after_800ms(cx: &mut TestAppContext) {+ let (workbench, cx) = open(Arc::new(Mutex::new(Storage::in_memory())), cx);+ let header = cx.debug_bounds("pane-header-outline").unwrap().center();+ let item = cx.debug_bounds(SCM_CONTAINER).unwrap().center();+ cx.simulate_mouse_down(header, gpui::MouseButton::Left, gpui::Modifiers::none());+ cx.simulate_mouse_move(header + gpui::point(gpui::px(10.), gpui::px(0.)), gpui::MouseButton::Left, gpui::Modifiers::none());+ cx.simulate_mouse_move(item, gpui::MouseButton::Left, gpui::Modifiers::none());+ cx.executor().advance_clock(std::time::Duration::from_millis(700));+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.side_bar_view), SideBarView::Explorer);+ cx.executor().advance_clock(std::time::Duration::from_millis(100));+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.side_bar_view), SideBarView::Scm);+ cx.simulate_mouse_up(item, gpui::MouseButton::Left, gpui::Modifiers::none());+}++#[gpui::test]+fn a_composite_dropped_where_it_already_is_still_opens(cx: &mut TestAppContext) {+ let (workbench, cx) = open(Arc::new(Mutex::new(Storage::in_memory())), cx);+ workbench.update_in(cx, |workbench, window, cx| {+ workbench.side_bar_view = SideBarView::Scm;+ workbench.drop_composite(SEARCH_CONTAINER, Part::SideBar, Some((SCM_CONTAINER, true)), window, cx);+ });+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.side_bar_view), SideBarView::Search);+}++#[gpui::test]+fn a_header_dragged_over_a_bar_item_shows_the_insert_line_on_its_side(cx: &mut TestAppContext) {+ let (_workbench, cx) = open(Arc::new(Mutex::new(Storage::in_memory())), cx);+ let header = cx.debug_bounds("pane-header-outline").unwrap().center();+ let item = cx.debug_bounds(SCM_CONTAINER).unwrap();+ let quarter = item.size.height / 4.;+ cx.simulate_mouse_down(header, gpui::MouseButton::Left, gpui::Modifiers::none());+ cx.simulate_mouse_move(header + gpui::point(gpui::px(10.), gpui::px(0.)), gpui::MouseButton::Left, gpui::Modifiers::none());+ cx.simulate_mouse_move(item.center() - gpui::point(gpui::px(0.), quarter), gpui::MouseButton::Left, gpui::Modifiers::none());+ let before = cx.debug_bounds("bar-insert-before").expect("the line above SCM");+ assert_eq!((before.size.width, before.size.height, before.top()), (item.size.width, gpui::px(2.), item.top()));+ cx.simulate_mouse_move(item.center() + gpui::point(gpui::px(0.), quarter), gpui::MouseButton::Left, gpui::Modifiers::none());+ assert!(cx.debug_bounds("bar-insert-before").is_none() && cx.debug_bounds("bar-insert-after").is_some());+ cx.simulate_mouse_move(header, gpui::MouseButton::Left, gpui::Modifiers::none());+ assert!(cx.debug_bounds("bar-insert-after").is_none());+ cx.simulate_mouse_up(header, gpui::MouseButton::Left, gpui::Modifiers::none());}diff --git a/native/crates/app/src/workbench/view_panes.rs b/native/crates/app/src/workbench/view_panes.rsindex c7fc151e5b9..8d9b9290bd3 100644--- a/native/crates/app/src/workbench/view_panes.rs+++ b/native/crates/app/src/workbench/view_panes.rs@@ -275,7 +275,7 @@ pub(super) struct ContainerPanes {hovered_sash: Option<usize>,sash_hover: Option<(usize, Task<()>)>,/// The pane a header is dragged over, and whether over its lower half.- drop: Option<(&'static str, bool)>,+ pub(super) drop: Option<(&'static str, bool)>,/// The header a pointer focused: paneHeaders.css `:focus:not(:focus-visible)` draws no outline until a key.pointer_focused: Option<&'static str>,/// Each pane's bounds in the last frame. `.pane:hover` tests the pointer against them: GPUI's `is_hovered` turns@@ -558,15 +558,21 @@ impl Workbench {}/// viewPaneContainer.ts `onDrop` of a `composite` on a pane: the container's views move into `container`, its- /// first one beside `target`.+ /// first active one (`allViewDescriptors[0]`) beside `target` when it has a pane, the hidden Repositories none.pub(super) fn merge_container_into(&mut self, dragged: &'static str, container: PaneContainer, target: Option<(&'static str, bool)>, cx: &mut Context<Self>) {if !self.can_merge_container(dragged, container.container_id()) {return;}let views = self.views_in(dragged);- for (index, view) in views.iter().enumerate() {+ let active = |view: &super::view_locations::MovableView| match view.id {+ SCM_REPOSITORIES_VIEW => !self.scm.model.providers.is_empty(),+ OPEN_EDITORS_VIEW | OUTLINE_VIEW | TIMELINE_VIEW => true,+ _ => self.movable_view_shown(view),+ };+ let anchor = views.iter().find(|view| active(view)).filter(|view| self.movable_view_shown(view)).map(|view| view.id);+ for view in &views {match target {- Some((target, below)) if index == 0 => self.drop_pane_from_container(view.id, container, target, below, cx),+ Some((target, below)) if Some(view.id) == anchor => self.drop_pane_from_container(view.id, container, target, below, cx),_ => self.move_view_to_container(view.id, container.container_id(), cx),}}@@ -703,6 +709,7 @@ impl Workbench {};pane.on_drag_move(cx.listener(move |workbench, event: &DragMoveEvent<DraggedPane>, _, cx| {if !event.bounds.contains(&event.event.position) {+ workbench.leave_pane_drop(container, id, cx);return;}let dragged = event.drag(cx);@@ -711,6 +718,7 @@ impl Workbench {})).on_drag_move(cx.listener(move |workbench, event: &DragMoveEvent<super::panel::DraggedComposite>, _, cx| {if !event.bounds.contains(&event.event.position) {+ workbench.leave_pane_drop(container, id, cx);return;}let accepts = workbench.can_merge_container(event.drag(cx).id, container.container_id());@@ -743,6 +751,14 @@ impl Workbench {})}+ /// `onDragLeave` disposes the overlay of pane `id`.+ fn leave_pane_drop(&mut self, container: PaneContainer, id: &'static str, cx: &mut Context<Self>) {+ // A generated container's panes go when it moves away, while its last frame's handlers still run.+ if self.panes_laid_out(container) && self.panes(container).drop.is_some_and(|(target, _)| target == id) {+ self.set_pane_drop(container, None, cx);+ }+ }+fn set_pane_drop(&mut self, container: PaneContainer, drop: Option<(&'static str, bool)>, cx: &mut Context<Self>) {let panes = self.panes_mut(container);if panes.drop != drop {@@ -779,8 +795,7 @@ impl Workbench {/// neighbouring header; dragged onto another pane it moves this one.#[allow(clippy::too_many_arguments)]fn pane_header(&self, container: PaneContainer, index: usize, id: &'static str, title: &str, description: Option<String>, actions: Option<AnyElement>, show_actions: bool, expanded: bool, count: usize, window: &Window, cx: &mut Context<Self>) -> Div {- let title = crate::nls::localize_in(id, title);- let has_actions = expanded && actions.is_some();+ let title = self.moved_view_title(id, crate::nls::localize_in(id, title).into_owned());let focus = &self.panes(container).focus[id];let focused = focus.is_focused(window);// paneview.css: the actions show on `.pane:focus-within` and with `workbench.view.alwaysShowHeaderActions`.@@ -791,6 +806,9 @@ impl Workbench {|| (id == OUTLINE_VIEW && self.outline_pane.focus.is_focused(window))|| (id == super::testing_view::TESTING_VIEW && (self.testing_view.tree_focus.is_focused(window) || self.testing_view.filter.focus.is_focused(window)))|| self.setting("workbench.view.alwaysShowHeaderActions") == json!(true);+ // paneview.css: the actions are `display: none` until shown, so they take no room from the title.+ let actions = actions.filter(|_| expanded && (show_actions || self.pane_hovered(container, id, window)));+ let has_actions = actions.is_some();let foreground = self.foreground_or("sideBarSectionHeader.foreground");// modernUI paneHeaders.css: in the panel the header takes the panel's background and separator colors.let in_panel = self.container_location(container.container_id()) == super::layout::Part::Panel;@@ -848,8 +866,8 @@ impl Workbench {div().ml(px(10.)).text_size(px(12.)).text_color(self.color("panelTitle.inactiveForeground")).overflow_hidden().whitespace_nowrap().child(description)})).when(id == SCM_HISTORY_VIEW, |header| header.children(self.scm_graph_outdated_badge()))- .children(actions.filter(|_| expanded).map(|actions| {- let bar = div().flex_none().ml_auto().mr(px(4.)).invisible().when(show_actions || self.pane_hovered(container, id, window), |actions| actions.visible()).child(actions);+ .children(actions.map(|actions| {+ let bar = div().flex_none().ml_auto().mr(px(4.)).debug_selector(move || format!("pane-actions-{id}")).child(actions);self.action_bar(id, false, bar, cx)}))// extensionsViews.ts `renderHeader`: the count badge after the actions, at the right end.diff --git a/port/ledger.md b/port/ledger.mdindex 9f4116bcf2b..8cdf2c78402 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -163,6 +163,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,| Later | Bun host size | later | Dropped from 57 to 41 MiB between milestones 1 and 2, not investigated (`port/results/benchmark.md` before the README benchmark, in git history). | || Later | Wu memory | later | Measured 99 MiB once and 154 to 156 MiB later, cause not investigated. | || Later | Bun native-watchdog | later | Bun runs without `@vscode/native-watchdog` (oven-sh/bun#18546): a host with a stuck event loop is not killed; recheck on each Bun upgrade. | |+| Later | composite bar insert line | later | activity_bar_menu.rs `with_composite_drop`: a drag past the last item shows no `dragged-over-tail` line; the line's side flips at the item's midpoint where compositeBarActions.ts `updateFromDragging` keeps it until 40% or 60%; in the vertical activity bar the 2px line spans the item, not `--activity-bar-width`, not paired with the reference. | ui-pair of a container dragged past the last item of each bar || Later | files pass leftovers | later | No TypeScript suggest list after typing `x` in the ui-pair run (unchecked); Explorer not paired in the light and high contrast themes. | |## Units@@ -449,8 +450,8 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| editor/contrib/wordOperations | src/vs/editor/contrib | M5 | verified | | editor/word_operations.rs ports cursorWordOperations.ts (WordOperations, WordPartOperations, `editor.wordSeparators`, `editor.wordSegmenterLocales` through ICU word segments, the auto-closing pair delete) with the 16 move, 8 delete and Delete Word commands: cargo test -p app word_operations (43 passed: every wordOperations.test.ts and wordPartOperations.test.ts case) || editor/contrib/wordPartOperations | src/vs/editor/contrib | M8 | verified | | cursorWordPart(Left/Right)(Select), deleteWordPart(Left/Right), aliases cursorWordPartStartLeft(Select); cargo test -p app word_part (upstream cases); ui-pair Ctrl+Alt arrows, Ctrl+Alt+Backspace/Delete || editor/contrib/zoneWidget | src/vs/editor/contrib | M13 | verified | | editor/view_zones.rs (cargo test -p app view_zones), arrow and frame; the references peek's resize sash (whole lines, 5 to 35) and split view sash, stored as `peekViewLayout` (cargo test -p app references_peek); ui-pair against the reference: port/results/navigation.md |-| workbench/parts/activitybar | workbench part | M9 | verified | | workbench/activity_bar_menu.rs: cargo test -p app manage_menu activity_bar_menu the_source_control_run_and_debug_and_extensions_items_open_their_views the_source_control_and_extensions_items_badge_their_counts the_activity_bar_items_take_the_keyboard_focus_with_their_hover; port/tools/update-check; ui-pair m11/manage-menu.json (port/results/manage-menu.md), icons/activity-bar-menu.json (port/results/icons.md); pixel-check (port/results/pixels.md). The Accounts icon is removed by decision (no sign-in) |-| workbench/parts/auxiliarybar | workbench part | M11 | verified | | card with the composite title (the moved containers' tabs, their title actions, Toggle Maximized Secondary Side Bar with its toggled background, Hide Secondary Side Bar) over the active view or the empty message; Alt+Cmd+B, Maximize/Restore/Toggle Maximized Secondary Side Bar (layout.ts `setAuxiliaryBarMaximized`, `auxiliaryBarMaximized`); a panel tab dropped on it moves its container there (`views.customizations`, `workbench.auxiliarybar.activepanelid`) with the empty part's drop feedback; cargo test -p app part_grid (maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back, a_panel_view_dropped_on_the_secondary_side_bar_opens_there_and_stays_there); ui-pair port/fixtures/ui-steps/auxiliarybar.json (port/results/layout.md, secondary side bar): empty state, maximize tooltip, maximized and restored, the drag feedback and the moved Problems view as the reference |+| workbench/parts/activitybar | workbench part | M9 | verified | | workbench/activity_bar_menu.rs: a composite or a view dragged over a bar item shows the 2px insert line on its side in `activityBar.dropBorder`, `activityBarTop.dropBorder` or `panel.dropBorder` and opens the item after 800ms (dnd.ts `DelayedDragHandler`); a composite dropped where it already is opens (cargo test -p app a_header_dragged_over_a_bar_item_shows_the_insert_line a_header_held_over_an_activity_item_opens_it_after_800ms a_composite_dropped_where_it_already_is_still_opens; the reference draws no drag feedback under ui-pair's synthetic drag, so only the drop result is paired); cargo test -p app manage_menu activity_bar_menu the_source_control_run_and_debug_and_extensions_items_open_their_views the_source_control_and_extensions_items_badge_their_counts the_activity_bar_items_take_the_keyboard_focus_with_their_hover; port/tools/update-check; ui-pair m11/manage-menu.json (port/results/manage-menu.md), icons/activity-bar-menu.json (port/results/icons.md); pixel-check (port/results/pixels.md). The Accounts icon is removed by decision (no sign-in) |+| workbench/parts/auxiliarybar | workbench part | M11 | verified | | with the activity bar on top or bottom the composite bar is a header of 36x32 icon items over a title row and Hide Secondary Side Bar is left out (auxiliaryBarPart.ts `canShowLabels`; cargo test -p app the_secondary_side_bar_shows_icons_over_a_title_with_the_activity_bar_on_top); card with the composite title (the moved containers' tabs, their title actions, Toggle Maximized Secondary Side Bar with its toggled background, Hide Secondary Side Bar) over the active view or the empty message; Alt+Cmd+B, Maximize/Restore/Toggle Maximized Secondary Side Bar (layout.ts `setAuxiliaryBarMaximized`, `auxiliaryBarMaximized`); a panel tab dropped on it moves its container there (`views.customizations`, `workbench.auxiliarybar.activepanelid`) with the empty part's drop feedback; cargo test -p app part_grid (maximizing_the_secondary_side_bar_hides_the_other_parts_and_restore_brings_them_back, a_panel_view_dropped_on_the_secondary_side_bar_opens_there_and_stays_there); ui-pair port/fixtures/ui-steps/auxiliarybar.json (port/results/layout.md, secondary side bar): empty state, maximize tooltip, maximized and restored, the drag feedback and the moved Problems view as the reference || workbench/parts/banner | workbench part | M11 | verified | | workbench/banner.rs (bannerPart.ts): one item by priority, icon, message with ellipsis, link actions, Close Banner; Focus Banner, `bannerFocused`, arrow keys through the links and the close button, Enter and Space on them. `cargo test -p app banner`; verified: ui-pair banner.json vs the reference (port/results/windows.md, milestone 11 verification) || workbench/parts/chat | workbench part | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/parts/dialogs | workbench part | M11 | verified | | workbench/dialog_view.rs custom dialog, used for every message box with `window.dialogStyle: custom` (severity codicons, plain detail); cargo test -p app dialogs; verified: ui-pair dialogs.json `custom-modal` vs the reference (port/results/windows.md, milestone 11 verification): size, buttons in macOS order, Close Dialog; its buttons and Close Dialog are accessibility buttons named by their labels (dialog.ts monaco Buttons, the close action's aria-label): port/tools/update-check pre-release presses "Trust Publisher & Install" through them |@@ -462,7 +463,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/parts/sidebar | workbench part | M11 | verified | | Explorer and Search; compact activity bar for top and bottom (side_bar.rs) with every container the activity bar shows: built-in, Testing, extensions' `viewsContainers.activitybar` from startup and after an install, and generated ones (cargo test -p app the_top_activity_bar_shows_contributed_containers; it showed the five built-in ones only until then), No Folder Opened welcome in an empty window (empty_view.rs); pixel-check (port/results/pixels.md, milestone 3): chevron and label edge pixels only; ui-pair port/results/layout.md; verified: every pair of port/results/windows.md (milestone 11 verification) and port/results/references-view.md || workbench/parts/statusbar | workbench part | M11 | verified | | status_entries.rs: cargo test -p app a_hovered_status_item_is_outlined_and_its_icons_take_the_hover_foreground a_hovered_extension_entry_s_icons_follow_its_label_color the_status_bar_has_no_remote_indicator editor_status; ui-pair port/fixtures/ui-pair/statusbar-hover.json hc with `PORT_MESSAGES=status`, messages.json (port/results/windows.md, milestone 11 verification). No remote indicator: workbench/contrib/remote removed (port/notes.md) || workbench/parts/titlebar | workbench part | M9 | verified | | cargo test -p app the_title_bar_menu_shows_contributed_global_actions manage_menu title_bar theme::tests; ui-pair `menus/title-bar.json` with port/fixtures/extensions/menus, `new-window.json` (port/results/windows.md); port/results/command-center.md, port/results/manage-menu.md; pixel-check file and titlebar (port/results/pixels.md); cargo test -p app an_editor_windows_title_bar_shows_the_global_actions_until_compact |-| workbench/parts/views | workbench part | M11 | verified | | view_panes.rs `PaneContainer`: cargo test -p app view_panes scm_container a_welcome_button_draws_its_label_icons wrapped_lines_keep_their_fractional_line_height a_merged_changes_view_shows_the_views_submenu_in_its_more_actions a_merged_view_without_actions_lists_the_view_toggles_flat; ui-pair port/results/layout.md, port/fixtures/ui-pair/m11/scm-panes.json, port/fixtures/ui-pair/icons/scm-welcome.json, port/results/references-view.md, port/results/windows.md (milestone 11 verification); port/notes.md View panes |+| workbench/parts/views | workbench part | M11 | verified | | view_panes.rs `PaneContainer`: a pane's drop overlay goes when the drag leaves it, the header actions take no room until shown (paneview.css `display: none`), a view away from its default container is titled `Container: View` (viewPane.ts `calculateTitle`), a container dropped on a pane puts its first active view there (cargo test -p app a_pane_drop_overlay_goes_when_the_drag_leaves_the_pane a_container_dropped_on_a_pane_puts_its_first_active_view_there; ui-pair port/fixtures/ui-steps/dnd-4.json with `workbench.activityBar.location: top`); cargo test -p app view_panes scm_container a_welcome_button_draws_its_label_icons wrapped_lines_keep_their_fractional_line_height a_merged_changes_view_shows_the_views_submenu_in_its_more_actions a_merged_view_without_actions_lists_the_view_toggles_flat; ui-pair port/results/layout.md, port/fixtures/ui-pair/m11/scm-panes.json, port/fixtures/ui-pair/icons/scm-welcome.json, port/results/references-view.md, port/results/windows.md (milestone 11 verification); port/notes.md View panes || workbench/services/accessibility | workbench service | M19 | verified | | electron-browser accessibilityService.ts over GPUI: screen reader attach follows Electron's `isAccessibilitySupportEnabled` on macOS (VoiceOver, or an assistive app setting AXManualAccessibility or AXEnhancedUserInterface, as cua-driver does; ui-pair screen-reader-detection.json with accessibility support auto shows the prompt in both), the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib; electron-browser accessibilityService.ts over GPUI: screen reader attach follows is_a11y_active, the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib || workbench/services/accounts | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/services/actions | workbench service | M9 | verified | | menus::extension_menus: cargo test -p app menus explorer_actions api_menu_keys_reach_their_menus a_folder_row a_history_item_menu view_container_title the_debug_container_more_actions the_manage_menu_lists_the_extension_context_menu editor_title_run the_comment_editor_actions_and_context_menus_run_their_menus open_merge_editor_resets; ui-pair `menus/view-container-title.json`, `menus/extension-context.json`, `menus/editor-title-run.json` with `--extensionDevelopmentPath=port/fixtures/extensions/menus`, README.md Explorer menu (port/results/contextmenu.md). Removed by decision: issue/reporter, ports/*, statusBar/remoteIndicator and the AI menu ids (port/notes.md:35) |@@ -519,7 +520,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/services/notification | workbench service | M11 | verified | | `notify`, `prompt` and the Do Not Disturb filters (global and per source, stored in application storage) on Workbench (notifications_view.rs); cargo test -p app notifications_view; verified: ui-pair messages.json vs the reference (port/results/windows.md, milestone 11 verification) || workbench/services/outline | workbench service | M13 | verified | | the document symbols outline of the active editor (workbench/outline_pane.rs): breadcrumb symbols from `getItemEnclosingPosition` with `breadcrumbs.symbolPath` and `breadcrumbs.show*`, the Outline view's tree, drawing only the rows in view as listView.ts does (cargo test -p app the_outline_draws_only_the_rows_in_view); cargo test -p app outline_pane; ui-pair Outline title actions with a.ts symbols (port/results/language-features.md Outline title actions) || workbench/services/output | workbench service | M15 | verified | | a logger's `group` is set only by the shared process (workbench/services/sharedProcess) and the hidden telemetry loggers (workbench/contrib/telemetry), `when` by no caller. output.rs: channels read from their files from a start offset, Replace/Clear move it, log channels from visible loggers, `OutputViewFilters` and `parseLogEntryAt` (output/filter.rs), the active channel and its log level: cargo test -p app output (14 tests) |-| workbench/services/panecomposite | workbench service | M11 | verified | | active side bar container (built-in or contributed, workbench/view_containers.rs) and active panel view (workbench.panelpart.activepanelid), open and close per location; panel view containers move between the panel and the secondary side bar by drag and drop (`moveViewContainerToLocation`, `views.customizations`; cargo test -p app a_panel_view_dropped_on_the_secondary_side_bar, ui-pair port/results/layout.md); side bar containers and single views move by drag and drop too: a view dropped on a bar item gets a new container at the drop position, a container dropped on a pane merges its views beside it (cargo test -p app a_view_dropped_on_a_bar_item a_container_dropped_on_a_pane a_header_dropped_on_a_panel_view_shown_alone outline_header_dragged_onto; ui-pair port/fixtures/ui-steps/dnd-1.json to dnd-4.json with `workbench.activityBar.location: top`); ui-pair port/results/references-view.md and problems.md; active side bar view and active panel view (workbench.panelpart.activepanelid) only; no view container registry; verified: ui-pair port/results/references-view.md and problems.md (milestone 11 verification) |+| workbench/services/panecomposite | workbench service | M11 | verified | | active side bar container (built-in or contributed, workbench/view_containers.rs) and active panel view (workbench.panelpart.activepanelid), open and close per location; panel view containers move between the panel and the secondary side bar by drag and drop (`moveViewContainerToLocation`, `views.customizations`; cargo test -p app a_panel_view_dropped_on_the_secondary_side_bar, ui-pair port/results/layout.md); side bar containers and single views move by drag and drop too: a view dropped on a bar item gets a new container at the drop position, a container dropped on a pane merges its views beside it (cargo test -p app a_view_dropped_on_a_bar_item a_container_dropped_on_a_pane a_header_dropped_on_a_panel_view_shown_alone outline_header_dragged_onto; ui-pair port/fixtures/ui-steps/dnd-1.json to dnd-4.json with `workbench.activityBar.location: top`); ui-pair port/results/references-view.md and problems.md; the active side bar container comes back from `workbench.sidebar.activeviewletid` while it stays in the side bar, stored at quit (port/notes.md Views drag and drop; cargo test -p app the_active_side_bar_container_is_restored_while_it_stays_in_the_side_bar); no view container registry; verified: ui-pair port/results/references-view.md and problems.md (milestone 11 verification) || workbench/services/path | workbench service | M12 | verified | | the user home is $HOME (path_label, tildify), hasValidBasename is file_actions.rs is_valid_basename (cargo test -p app validates_file_names); pathService.test.ts covers only remote path semantics (no remote); verified at port-m12b-verify: cargo test -p app validates_file_names 1/1 || workbench/services/policies | workbench service | M10 | removed | | account policies, managed chat settings, the organization support link and policy telemetry need sign-in, AI or telemetry, none of which the port has by decision (port/notes.md); system policies are the platform/policy row || workbench/services/power | workbench service | M19 | verified | | workbench/power.rs: suspend, resume, shutdown, lock, unlock, thermal, battery and speed limit events to ExtHostPower; port/tools/shell-check (port/fixtures/extensions/shell-tests, 6/6); cargo test -p app power |diff --git a/port/notes.md b/port/notes.mdindex e7d13f79ccc..1b407e2a843 100644--- a/port/notes.md+++ b/port/notes.md@@ -582,6 +582,7 @@ Scope (milestone 13): diagnostics, hover, completion, go to definition and peek,- Side bar card and compact activity bar (`workbench/side_bar.rs`): with `workbench.activityBar.location` `top` or `bottom` the view containers are 36x32 tabs in the side bar's header or footer on the tab strip's background, and the Manage gear moves to the title bar (`workbench.action.activityBarLocation.top`/`.bottom`).- Empty window Explorer (`workbench/empty_view.rs`; emptyView.ts, explorerViewlet.ts): No Folder Opened expanded with "You have not yet opened a folder." and Open Folder, plus the `noFolderButEditorsHelp` line while editors are open. `workbench.action.files.openFolder` picks a folder and relaunches the binary with this window's flags and the folder, then quits (as upstream replaces the window). shortcut: with unsaved editors this window stays open (hot exit is item 5); the git extension's Clone Repository welcome item and `workbench.action.addRootFolder` are not ported.- View panes (`workbench/view_panes.rs`; paneview.ts, viewPaneContainer.ts, viewContainerModel.ts): the Explorer's views (the folder's or No Folder Opened, Outline, Timeline) and Source Control's (Changes, Graph while the active repository has a history provider, contributed views collapsed) and the Extensions viewlet's (extensionsViewlet.ts: below its 41px search header, one view merged with the container; `flexibleHeight` Installed and Recommended store their count as `{id}.size` and take no body while it is 0, Outdated expands while it lists any, Workspace Recommendations and, without installed extensions, Recommended expand on show if not empty; header count badges except Popular's, Update All Extensions and the workspace recommendation actions always shown; `cargo test -p app the_views_are_panes`) in a split view per `PaneContainer`, a collapsed pane its 28px header, an expanded one at least the header and 120px. A header click, Enter or Space toggles, Left collapses, Right expands, Up and Down move between headers; an expanded pane comes back at its last size. Sashes between panes as the grid's (300 ms hover, mac cursors). Dragging a header onto another pane moves it before or after that pane by the half it is over, with the `sideBar.dropBackground` overlay (dashed `contrastActiveBorder` outline in high contrast). State as `ViewDescriptorsState`: collapsed and size per view in workspace storage `workbench.explorer.views.state` (`workbench.scm.views.state`), order in profile storage `<storageId>.hidden`. A single view merges into the container (`mergeViewWithContainerWhenSingleView`): no header, the composite title is its `singleViewPaneContainerTitle` ("Source Control") or "Container: View", its actions beside it. A header's actions show on hover, with focus in the header or the body (`:focus-within`), for Graph whenever expanded (`ViewPaneShowActions.WhenExpanded`), or with `workbench.view.alwaysShowHeaderActions`; a header focused by a click has no outline (`:focus-visible`). The Changes header carries SCMTitle's navigation actions and "..." (`isHiddenByDefault` View as List/Tree not listed: no toolbar menu shows a hidden action); the container title's "..." is the Views submenu. ui-pair port/fixtures/ui-pair/m11/scm-panes.json (FOLDER: port/fixtures/workspace as a git repository with two commits and notes.txt changed): the Changes and Graph headers with their actions, Graph collapsed, Changes collapsed, as the reference. Session m11f, the pair again with FOLDER a git repository of port/fixtures/workspace (two commits, notes.txt changed; the script makes it in /tmp): the Changes group row and resource rows at the reference's x (group twistie 7px further in and the label 3px after it, resource icon 4px past its indent, measured), the Graph header's "Auto" ref picker (`SCMHistoryItemRefsActionViewItem` of the 'auto' filter: `git-branch`, "Auto" at 11px in `icon.foreground`, the current, remote and base refs as tooltip), disabled header actions at 0.4 opacity (git.pullRef without a remote), the decoration letter in `gitDecoration.*` colors and the name in the row's foreground (`fileDecorations: { colors: false }`), from contributed colors (theme.rs `extension_colors`, colorExtensionPoint.ts). Since the fourth pass equal there too: the header actions 24px apart with the title ellipsized ("Gr..."), `git-fetch` drawn as `repo-fetch` (codicons.ts registers it again at 0xec1d over codiconsLibrary.ts's 0xecb2), and the Graph pane 3px above the middle (`computeInitialSizes` shares the container's height with its 5px bottom gap). The Run and Debug, Extensions and webview containers still use `section_header`.+- Views drag and drop (branch views-dnd; compositeBar.ts, compositeBarActions.ts, viewPaneContainer.ts, dnd.ts): a view header dropped on a bar item gets a new container before or after it by the half it is over (compositeBar.ts `drop`), a container dropped on a pane merges its views there with its first active view at the drop position, a composite dropped where it already is opens focused. Held 800 ms over a bar item, a drag opens it (`DelayedDragHandler`). The active side bar container (`workbench.sidebar.activeviewletid`) is stored at quit and on release, not on each open as compositePart.ts does: the port sets the side bar view in 14 places without one change event, and only the value at quit is read back.- Text models and editors (coordinator decision, option A): `TextModel` (document, version, undo stack, guides, markers, host reference) is shared as `SharedModel = Rc<RefCell<TextModel>>` by every editor of its resource in any group; `OpenEditor` keeps the view state (selections, scroll, folding, highlights, view zones). An edit is logged on the model (`TextModel.edits`, 1000 replaces); an editor of another group follows it in `sync_with_model` (cursors tracked as decorations are, else clamped), run each frame and on group activation.- Editor groups (`editor_grid.rs`, `workbench/editor_groups.rs`; gridview.ts, grid.ts, editorPart.ts, editorCommands.ts): `EditorGroup` holds the active group in its fields and the others in `other_groups`; `activate_group` swaps them, and another group draws through the same editor code while swapped in (`with_group`, `drawing_inactive` leaves out its focus, input handler and widgets; a press activates it first). Models, diffs, disposed models and view states are the part's. The host sees one text editor per group showing one (`editorPosition` = grid order) and every group in `$acceptEditorTabModel`; tab ids start with the group id. A tab drags within its group, onto another group's tabs, or onto a group's body, whose edges split it (editorDropTarget.ts `getSplitDirection`, `split_direction`). The grid and each group's file editors (tab order, MRU, preview) persist in the workspace memento `memento/workbench.parts.editor` under `editorpart.state` in upstream's JSON shape, saved on every editor change and restored with the workspace state (`editor_groups/part_state.rs`; the `sticky` count per group restores pinned file and notebook editors; other editor kinds and locked groups store `locked`). shortcut: `$closeTab` across several groups at once is not ported yet.- History (`navigation.rs`, `workbench/history_actions.rs`; historyService.ts): the three navigation stacks per `workbench.editor.navigationScope` key, fed by editor changes (`editors_changed`), cursor moves (`cursors_changed`, source to reason as textEditor.ts) and edits. Reopen Closed Editor keeps file editors only (a diff or untitled editor has no reopenable input in the port). shortcut: mouse buttons 4 and 5 (`workbench.editor.mouseBackForwardToNavigate`) are not read.