Visual Studio Code, rebuilt in Rust
Rust
feat(views): store view container locations for every part
rokartur6e64a521dce8
diff --git a/native/crates/app/src/workbench.rs b/native/crates/app/src/workbench.rsindex 0523ee43da4..a5fa9480a5e 100644--- a/native/crates/app/src/workbench.rs+++ b/native/crates/app/src/workbench.rs@@ -1131,6 +1131,7 @@ impl Workbench {self.load_command_history();self.load_quick_input_view_state();self.load_notification_filters();+ self.leave_moved_side_bar_container();}/// The opened folders, which quick pick items show their resource paths relative to.@@ -1540,7 +1541,7 @@ impl Workbench {let hover = HoverOptions::composite_bar(if left { HoverPosition::Right } else { HoverPosition::Left });let inactive = self.color("activityBar.inactiveForeground");let unpinned = self.unpinned_containers();- let containers = side_bar::VIEW_CONTAINERS.into_iter().filter(|(_, _, _, command, _)| !self.container_hidden_if_empty(command) && !unpinned.iter().any(|id| id == command));+ let containers = side_bar::VIEW_CONTAINERS.into_iter().filter(|(_, _, _, command, _)| !self.container_hidden_if_empty(command) && !unpinned.iter().any(|id| id == command) && self.container_location(command) == layout::Part::SideBar);let items: Vec<_> = containers.map(|(icon, _, title, command, view)| {let active = view.is_some_and(|view| self.side_bar_view == view) && self.side_bar_visible();let icon = if active { self.active_view_icon(icon) } else { self.icon(icon, 36., 24., inactive) };@@ -1666,8 +1667,7 @@ impl Workbench {return self.contributed_side_bar(id, window, cx);}if let SideBarView::Generated(id) = self.side_bar_view {- let title = self.generated_container_view(id).map_or("", |view| view.name);- return self.view_pane_container(view_panes::PaneContainer::Generated(id), title, Vec::new(), window, cx).child(div().h(px(5.)).flex_none());+ return self.view_pane_container(view_panes::PaneContainer::Generated(id), &self.container_title(id), Vec::new(), window, cx).child(div().h(px(5.)).flex_none());}if self.side_bar_view == SideBarView::Scm {return self.scm_side_bar(window, cx);diff --git a/native/crates/app/src/workbench/activity_bar_menu.rs b/native/crates/app/src/workbench/activity_bar_menu.rsindex 7a71bb484dc..359a1274d00 100644--- a/native/crates/app/src/workbench/activity_bar_menu.rs+++ b/native/crates/app/src/workbench/activity_bar_menu.rs@@ -22,17 +22,17 @@ const TOGGLE_PINNED_PREFIX: &str = "workbench.action.activityBar.togglePinned.";impl Workbench {/// The containers the activity bar can show (`visibleItems`), pinned or not, in its order: id and title.pub(super) fn activity_bar_containers(&self) -> Vec<(&'static str, &'static str)> {- let mut containers: Vec<_> = VIEW_CONTAINERS.into_iter().filter(|(_, _, _, command, _)| !self.container_hidden_if_empty(command)).map(|(_, _, title, command, _)| (command, title)).collect();- if self.testing_container_shown() {+ let mut containers: Vec<_> = VIEW_CONTAINERS.into_iter().filter(|(_, _, _, command, _)| !self.container_hidden_if_empty(command) && self.container_location(command) == super::layout::Part::SideBar).map(|(_, _, title, command, _)| (command, title)).collect();+ if self.testing_container_shown() && self.container_location(super::view_locations::TESTING_CONTAINER) == super::layout::Part::SideBar {containers.push(("workbench.view.testing", "Testing"));}for container in &self.tree_views.containers {- if container.location == super::layout::Part::SideBar && !self.shown_views_of(&container.key).is_empty() {+ if self.container_location(container.id) == super::layout::Part::SideBar && !self.shown_views_of(&container.key).is_empty() {containers.push((container.id, super::tree_view::static_id(&container.title)));}}for id in self.generated_containers_in(super::layout::Part::SideBar) {- containers.push((id, self.generated_container_view(id).expect("a container with a view").name));+ containers.push((id, super::tree_view::static_id(&self.container_title(id))));}containers}diff --git a/native/crates/app/src/workbench/debug_service.rs b/native/crates/app/src/workbench/debug_service.rsindex 659314a4fae..c2fed5ea0e4 100644--- a/native/crates/app/src/workbench/debug_service.rs+++ b/native/crates/app/src/workbench/debug_service.rs@@ -1362,10 +1362,9 @@ impl Workbench {}}- /// Opens the Run and Debug view in the side bar.+ /// Opens the Run and Debug view where its container is.pub(crate) fn show_debug_view(&mut self, cx: &mut Context<Self>) {- self.side_bar_view = super::search_view::SideBarView::Debug;- self.set_part_hidden(super::layout::Part::SideBar, false, cx);+ self.show_view_container(super::debug_view::DEBUG_CONTAINER, cx);}}diff --git a/native/crates/app/src/workbench/panel.rs b/native/crates/app/src/workbench/panel.rsindex c7ae48c97ae..5cd93cac468 100644--- a/native/crates/app/src/workbench/panel.rs+++ b/native/crates/app/src/workbench/panel.rs@@ -184,29 +184,24 @@ impl Workbench {});}- /// `getViewContainerLocation`: the panel, unless `views.customizations` moved the container to the secondary side bar.- pub(super) fn view_container_part(&self, id: &str) -> Part {- match self.view_customizations()["viewContainerLocations"][id].as_u64() {- Some(2) => Part::AuxiliaryBar,- _ => Part::Panel,- }- }-- /// `moveViewContainerToLocation` and `openPaneComposite(id, true)` of a container dropped on `part`. Only moved+ /// `moveViewContainerToLocation` and `openViewContainer(id, true)` of a container moved to `part`. Only moved/// containers keep an entry (`saveViewCustomizations` skips the default location).pub(super) fn move_view_container(&mut self, id: &'static str, part: Part, window: &mut Window, cx: &mut Context<Self>) {+ if !self.can_move_container(id) {+ return;+ }+ let at_default = part == self.default_container_location(id) && !is_generated_container(id);let mut customizations = self.view_customizations();- let generated = is_generated_container(id);let locations = customizations["viewContainerLocations"].as_object_mut().expect("normalized");- match part {- Part::AuxiliaryBar => drop(locations.insert(id.to_owned(), json!(location_code(part)))),- _ if generated => drop(locations.insert(id.to_owned(), json!(location_code(part)))),- _ => drop(locations.remove(id)),+ match at_default {+ true => drop(locations.remove(id)),+ false => drop(locations.insert(id.to_owned(), json!(location_code(part)))),}self.save_view_customizations(&customizations);+ self.leave_moved_side_bar_container();match self.panel.views.iter().find(|view| view.id == id) {Some(view) => (view.open)(self, window, cx),- None => self.show_panel_container(id, cx),+ None => self.show_view_container(id, cx),}}@@ -217,7 +212,7 @@ impl Workbench {self.open_moved_view(view, cx);return;}- self.show_panel_container(id, cx);+ self.show_view_container(id, cx);}/// The view of a built-in panel container when it is no longer in it.@@ -227,8 +222,14 @@ impl Workbench {moved.then_some(view.view_id)}- pub(super) fn show_panel_container(&mut self, id: &'static str, cx: &mut Context<Self>) {+ /// `openViewContainer`: shows the container in its part, the side bar or a panel that keeps it as its last active one.+ pub(super) fn show_view_container(&mut self, id: &'static str, cx: &mut Context<Self>) {let part = self.container_location(id);+ if part == Part::SideBar {+ self.side_bar_view = super::view_locations::side_bar_view_of(id);+ self.set_part_hidden(Part::SideBar, false, cx);+ return self.editors_changed(cx);+ }let key = match part {Part::AuxiliaryBar => {self.panel.auxiliary_active = Some(id);@@ -250,7 +251,7 @@ impl Workbench {fn show_panel(&mut self, cx: &mut Context<Self>) {self.set_part_hidden(Part::Panel, false, cx);if let Some(id) = self.active_container_in(Part::Panel) {- self.show_panel_container(id, cx);+ self.show_view_container(id, cx);}}@@ -259,7 +260,7 @@ impl Workbench {if let Some(view) = self.moved_panel_view(id) {return self.is_view_visible(view);}- let part = self.view_container_part(id);+ let part = self.container_location(id);self.is_part_visible(part) && self.active_container_in(part) == Some(id)}@@ -298,7 +299,7 @@ impl Workbench {let locations = customizations["viewContainerLocations"].as_object_mut().expect("normalized");for tab in moving {// Only moved containers keep an entry (`saveViewCustomizations` skips the default location).- match destination == Part::Panel && !is_generated_container(tab.id) {+ match destination == self.default_container_location(tab.id) && !is_generated_container(tab.id) {true => drop(locations.remove(tab.id)),false => drop(locations.insert(tab.id.to_owned(), json!(location_code(destination)))),}@@ -308,7 +309,7 @@ impl Workbench {self.set_part_hidden(source, true, cx);self.set_part_hidden(destination, false, cx);match active.filter(|_| destination_was_empty) {- Some(id) => self.show_panel_container(id, cx),+ Some(id) => self.show_view_container(id, cx),None => self.editors_changed(cx),}}@@ -328,20 +329,20 @@ impl Workbench {fn part_containers(&self, part: Part) -> Vec<CompositeTab> {let mut tabs = Vec::new();for view in &self.panel.views {- if self.view_container_part(view.id) == part && self.moved_panel_view(view.id).is_none() {+ if self.container_location(view.id) == part && self.moved_panel_view(view.id).is_none() {tabs.push(CompositeTab { id: view.id, title: view.title, view: view.view_id });}}// viewsExtensionPoint.ts: an extension's panel containers order after the built-in ones and `hideIfEmpty`.- for id in self.contributed_panel_containers() {- if self.view_container_part(id) == part && let Some(view) = self.views_in(id).into_iter().find(|view| self.view_when_holds(view)) {+ for id in self.tree_views.containers.iter().map(|container| container.id).collect::<Vec<_>>() {+ if self.container_location(id) == part && let Some(view) = self.views_in(id).into_iter().find(|view| self.view_when_holds(view)) {let title = self.tree_views.containers.iter().find(|container| container.id == id).expect("a contributed container").title.as_str();tabs.push(CompositeTab { id, title: super::tree_view::static_id(title), view: view.id });}}for id in self.generated_containers_in(part) {let view = self.generated_container_view(id).expect("a container with a view");- tabs.push(CompositeTab { id, title: view.name, view: view.id });+ tabs.push(CompositeTab { id, title: super::tree_view::static_id(&self.container_title(id)), view: view.id });}tabs}@@ -600,7 +601,7 @@ impl Workbench {})).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_panel_container(id, cx),+ None => workbench.show_view_container(id, cx),}))}@@ -680,7 +681,7 @@ impl Workbench {/// The size of the panel container's view: the part's content, or its pane's share of it when the view lies/// among other views of a panel container.fn filter_view_size(&self, container: &str) -> gpui::Size<Pixels> {- let mut size = self.composite_bar(self.view_container_part(container)).content_bounds.get().size;+ let mut size = self.composite_bar(self.container_location(container)).content_bounds.get().size;let Some(view) = self.panel.views.iter().find(|view| view.id == container).map(|view| view.view_id) else { return size };let Some(holder) = self.movable_view(view).map(|movable| self.view_container(&movable)) else { return size };if self.views_in(holder).iter().filter(|view| self.movable_view_shown(view)).count() < 2 {@@ -700,14 +701,14 @@ impl Workbench {/// tabs leave.pub(super) fn panel_filter_width(&self, container: &str, focused: bool) -> f32 {match focused {- true => self.composite_bar(self.view_container_part(container)).filter_room.get().clamp(FILTER_MIN_WIDTH, 400.),+ true => self.composite_bar(self.container_location(container)).filter_room.get().clamp(FILTER_MIN_WIDTH, 400.),false => FILTER_MAX_WIDTH,}}/// Measures a view's filter box in the title for the tab layout.pub(super) fn panel_filter_tracker(&self, container: &str) -> impl IntoElement {- super::output_view::bounds_tracker(self.composite_bar(self.view_container_part(container)).filter_bounds.clone())+ super::output_view::bounds_tracker(self.composite_bar(self.container_location(container)).filter_bounds.clone())}/// compositeBarActions.ts `CompositeOverflowActivityActionViewItem`: the "..." item listing the tabs that do not fit.diff --git a/native/crates/app/src/workbench/scm_view.rs b/native/crates/app/src/workbench/scm_view.rsindex 6a43c9810f0..5bfb352fdb0 100644--- a/native/crates/app/src/workbench/scm_view.rs+++ b/native/crates/app/src/workbench/scm_view.rs@@ -113,7 +113,7 @@ impl ScmView {impl Workbench {pub(in crate::workbench) fn register_scm_commands(&mut self) {self.commands.register("workbench.view.scm", |workbench, _, window, cx| {- workbench.side_bar_view = super::search_view::SideBarView::Scm;+ workbench.show_view_container(super::view_locations::SCM_CONTAINER, cx);workbench.focus_scm_input(window, cx);cx.notify();Outcome::done()diff --git a/native/crates/app/src/workbench/search_actions.rs b/native/crates/app/src/workbench/search_actions.rsindex 9d07adf197b..9df3104a584 100644--- a/native/crates/app/src/workbench/search_actions.rs+++ b/native/crates/app/src/workbench/search_actions.rs@@ -18,7 +18,6 @@ use super::auto_save::SaveReason;use super::explorer_actions::confirm;use super::find_widget::HISTORY_LIMIT;use super::input_box_view::InputId;-use super::layout::Part;use super::search_view::{MessagePart, RowAction, RowKey, RowKind, SEARCH_FIELDS, SearchField, SearchOption, SearchUiState, SearchView, SideBarView};use crate::anything_quick_access::TextRange;use crate::commands::Outcome;@@ -56,8 +55,7 @@ impl Workbench {Outcome::done()});self.commands.register("workbench.view.explorer", |workbench, _, window, cx| {- workbench.side_bar_view = SideBarView::Explorer;- workbench.set_part_hidden(Part::SideBar, false, cx);+ workbench.show_view_container(super::view_locations::EXPLORER_CONTAINER, cx);window.focus(&workbench.explorer.focus.clone(), cx);cx.notify();Outcome::done()@@ -508,8 +506,7 @@ impl Workbench {if self.open_moved_view(super::view_locations::SEARCH_VIEW, cx) {return;}- self.side_bar_view = SideBarView::Search;- self.set_part_hidden(Part::SideBar, false, cx);+ self.show_view_container(super::view_locations::SEARCH_CONTAINER, cx);}/// `searchWidget.focus(select, focusReplace)`.diff --git a/native/crates/app/src/workbench/view_containers.rs b/native/crates/app/src/workbench/view_containers.rsindex 17b1fd49830..62ac35f34f8 100644--- a/native/crates/app/src/workbench/view_containers.rs+++ b/native/crates/app/src/workbench/view_containers.rs@@ -200,7 +200,7 @@ impl Workbench {if self.panel_view_visible(id) && focused == part {return self.close_panel_view(id, cx);}- self.show_panel_container(id, cx);+ self.show_view_container(id, cx);} else {self.side_bar_view = SideBarView::Contributed(id);self.set_part_hidden(Part::SideBar, false, cx);@@ -246,7 +246,7 @@ impl Workbench {self.side_bar_view = SideBarView::Contributed(container);self.set_part_hidden(Part::SideBar, false, cx);} else {- self.show_panel_container(container, cx);+ self.show_view_container(container, cx);}self.expand_pane(PaneContainer::Contributed(container), id, cx);}@@ -313,7 +313,7 @@ impl Workbench {let mut items = Vec::new();let unpinned = self.unpinned_containers();for container in &self.tree_views.containers {- if container.location != Part::SideBar || self.shown_views_of(&container.key).is_empty() || unpinned.iter().any(|id| id == container.id) {+ if self.container_location(container.id) != Part::SideBar || self.shown_views_of(&container.key).is_empty() || unpinned.iter().any(|id| id == container.id) {continue;}let id = container.id;diff --git a/native/crates/app/src/workbench/view_locations.rs b/native/crates/app/src/workbench/view_locations.rsindex 4bf94be50a5..966d26b36f2 100644--- a/native/crates/app/src/workbench/view_locations.rs+++ b/native/crates/app/src/workbench/view_locations.rs@@ -166,12 +166,16 @@ impl Workbench {/// The containers views can be in: the side bar's, the panel's and the generated ones.fn container_ids(&self) -> Vec<&'static str> {let mut ids = self.side_bar_container_ids();- ids.extend(self.panel.views.iter().map(|view| view.id));- ids.extend(self.contributed_panel_containers());+ ids.extend(self.panel_container_ids());ids.extend(self.generated_containers());ids}+ /// The panel's built-in containers and the extensions' `viewsContainers.panel`: the panel is their default location.+ fn panel_container_ids(&self) -> Vec<&'static str> {+ self.panel.views.iter().map(|view| view.id).chain(self.contributed_panel_containers()).collect()+ }+fn generated_containers(&self) -> Vec<&'static str> {let customizations = self.view_customizations();customizations["viewContainerLocations"].as_object().into_iter().flatten().map(|(id, _)| id.as_str()).filter(|id| is_generated_container(id)).map(static_id).collect()@@ -186,15 +190,40 @@ impl Workbench {ids}- /// `getViewContainerLocation`.+ /// `getViewContainerLocation`: the stored location, else the default one.pub(super) fn container_location(&self, container: &str) -> Part {- if self.side_bar_container_ids().contains(&container) {- return Part::SideBar;+ match self.view_customizations()["viewContainerLocations"][container].as_u64() {+ Some(code) => location_of_code(code),+ None if is_generated_container(container) => Part::SideBar,+ None => self.default_container_location(container),}+ }++ /// `getDefaultViewContainerLocation`: a generated container's is where it was made.+ pub(super) fn default_container_location(&self, container: &str) -> Part {if is_generated_container(container) {- return self.view_customizations()["viewContainerLocations"][container].as_u64().map_or(Part::SideBar, location_of_code);+ return self.container_location(container);}- self.view_container_part(container)+ match self.panel_container_ids().contains(&container) {+ true => Part::Panel,+ false => Part::SideBar,+ }+ }++ /// The containers in `part` in its composite bar's order: those it is the default location of, those moved in,+ /// then the generated ones.+ pub(super) fn containers_in(&self, part: Part) -> Vec<&'static str> {+ let (own, moved_in) = match part {+ Part::SideBar => (self.side_bar_container_ids(), self.panel_container_ids()),+ _ => (self.panel_container_ids(), self.side_bar_container_ids()),+ };+ own.into_iter().chain(moved_in).chain(self.generated_containers()).filter(|id| self.container_location(id) == part).collect()+ }++ /// Whether Move To and a composite drop move the container. shortcut: the Extensions and Testing containers draw+ /// views the port does not move (ledger gap of workbench/services/views); upgrade with movable views of their own.+ pub(super) fn can_move_container(&self, container: &str) -> bool {+ container != super::extensions_view::VIEWLET_ID && container != TESTING_CONTAINER}/// The movable views in the container, in the movable views' order.@@ -209,9 +238,12 @@ impl Workbench {[EXPLORER_CONTAINER, SEARCH_CONTAINER, SCM_CONTAINER].contains(&container) && !self.views_in(container).iter().any(|view| self.movable_view_shown(view))}- /// The generated containers in the part that hold a view.+ /// The containers in `part` that hold a view and draw as the views moved into them: the generated ones and the+ /// built-in ones moved from the side bar to a panel or back. An extension's moved container draws as its own.pub(super) fn generated_containers_in(&self, part: Part) -> Vec<&'static str> {- self.generated_containers().into_iter().filter(|id| self.container_location(id) == part && !self.views_in(id).is_empty()).collect()+ let moved = |id: &str| (self.default_container_location(id) == Part::SideBar) != (part == Part::SideBar);+ let drawn_as_moved = |id: &'static str| is_generated_container(id) || (moved(id) && !matches!(pane_container(id), PaneContainer::Contributed(_)));+ self.containers_in(part).into_iter().filter(|id| drawn_as_moved(id) && !self.views_in(id).is_empty()).collect()}/// viewContainerModel.ts `updateContainerInfo`: a generated container takes its first view's name and icon.@@ -288,6 +320,15 @@ impl Workbench {}}+ /// A side bar whose container moved to a panel shows the first container left in it, as paneCompositePart.ts+ /// opens the default one when the active one is removed.+ pub(super) fn leave_moved_side_bar_container(&mut self) {+ if self.side_bar_container().is_none_or(|container| self.container_location(container) == Part::SideBar) {+ return;+ }+ self.side_bar_view = self.containers_in(Part::SideBar).first().map_or(SideBarView::Extensions, |container| side_bar_view_of(container));+ }+/// `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 };@@ -322,7 +363,7 @@ impl Workbench {self.expand_pane(pane_container(container), view, cx);}_ => {- self.show_panel_container(container, cx);+ self.show_view_container(container, cx);if self.generated_panes.contains_key(container) {self.expand_pane(PaneContainer::Generated(container), view, cx);}@@ -390,8 +431,9 @@ impl Workbench {pub(super) fn prepare_moved_view_panes(&mut self, window: &mut Window, cx: &mut Context<Self>) {let mut panes = Vec::new();if let Some(container) = self.side_bar_container() {+ let draws_moved_views = matches!(pane_container(container), PaneContainer::Generated(_));for view in self.views_in(container) {- if view.default_container != container {+ if view.default_container != container || draws_moved_views {panes.push(self.movable_view_pane(view.id, window, cx));}}@@ -469,12 +511,8 @@ impl Workbench {pub(super) fn containers_by_location(&self) -> Vec<(Part, &'static str, String)> {let mut containers = Vec::new();for part in [Part::SideBar, Part::Panel, Part::AuxiliaryBar] {- let mut ids: Vec<&'static str> = match part {- Part::SideBar => self.side_bar_container_ids(),- _ => self.panel.views.iter().map(|view| view.id).chain(self.contributed_panel_containers()).filter(|id| self.view_container_part(id) == part).collect(),- };- ids.extend(self.generated_containers_in(part));- for id in ids {+ let generated = self.generated_containers_in(part);+ for id in self.containers_in(part).into_iter().filter(|id| !is_generated_container(id) || generated.contains(id)) {containers.push((part, id, self.container_title(id)));}}@@ -644,14 +682,17 @@ pub(super) fn pane_container(container: &'static str) -> PaneContainer {}}-fn side_bar_view_of(container: &'static str) -> SideBarView {+pub(super) fn side_bar_view_of(container: &'static str) -> SideBarView {match container {EXPLORER_CONTAINER => SideBarView::Explorer,SEARCH_CONTAINER => SideBarView::Search,SCM_CONTAINER => SideBarView::Scm,DEBUG_CONTAINER => SideBarView::Debug,TESTING_CONTAINER => SideBarView::Testing,- other if is_generated_container(other) => SideBarView::Generated(other),- other => SideBarView::Contributed(other),+ super::extensions_view::VIEWLET_ID => SideBarView::Extensions,+ other => match pane_container(other) {+ PaneContainer::Contributed(id) => SideBarView::Contributed(id),+ _ => SideBarView::Generated(other),+ },}}diff --git a/native/crates/app/src/workbench/view_locations/tests.rs b/native/crates/app/src/workbench/view_locations/tests.rsindex 3271b2ace60..b639404f53a 100644--- a/native/crates/app/src/workbench/view_locations/tests.rs+++ b/native/crates/app/src/workbench/view_locations/tests.rs@@ -105,7 +105,7 @@ fn panel_views_move_to_the_secondary_side_bar_and_back(cx: &mut TestAppContext)assert!(in_panel.contains(&MARKERS_CONTAINER_ID));cx.update(|window, cx| {workbench.update(cx, |workbench, cx| {- workbench.show_panel_container(MARKERS_CONTAINER_ID, cx);+ workbench.show_view_container(MARKERS_CONTAINER_ID, cx);drop(workbench.execute_command("workbench.action.movePanelToSecondarySideBar", Vec::new(), window, cx));})});@@ -260,3 +260,28 @@ fn a_header_dropped_on_another_container_takes_the_drop_position(cx: &mut TestApassert_eq!(explorer_panes(&workbench, cx), [crate::workbench::view_panes::EMPTY_VIEW, TIMELINE_VIEW, OUTLINE_VIEW, MARKERS_VIEW_ID]);assert!(workbench.read_with(cx, |workbench, _| workbench.generated_containers().is_empty() && !workbench.generated_panes.contains_key(container)));}++#[gpui::test]+fn a_container_moves_between_the_side_bar_and_the_panel_and_keeps_its_location_on_restart(cx: &mut TestAppContext) {+ let profile = Arc::new(Mutex::new(Storage::in_memory()));+ let (workbench, window_cx) = open(profile.clone(), cx);+ workbench.update_in(window_cx, |workbench, window, cx| {+ workbench.move_view_container(EXPLORER_CONTAINER, Part::Panel, window, cx);+ workbench.move_view_container(crate::workbench::output_view::OUTPUT_VIEW_ID, Part::SideBar, window, cx);+ });+ window_cx.run_until_parked();+ assert_eq!(stored(&profile)["viewContainerLocations"], json!({ EXPLORER_CONTAINER: 1, "workbench.panel.output": 0 }));+ workbench.read_with(window_cx, |workbench, _| {+ assert!(workbench.part_tabs(Part::Panel).iter().any(|tab| tab.id == EXPLORER_CONTAINER));+ assert!(!workbench.part_tabs(Part::Panel).iter().any(|tab| tab.id == crate::workbench::output_view::OUTPUT_VIEW_ID));+ assert_eq!(workbench.side_bar_view, SideBarView::Generated(crate::workbench::output_view::OUTPUT_VIEW_ID));+ });++ let (restarted, window_cx) = open(profile.clone(), cx);+ restarted.read_with(window_cx, |workbench, _| {+ assert_eq!(workbench.container_location(EXPLORER_CONTAINER), Part::Panel);+ assert_eq!(workbench.containers_in(Part::SideBar).last(), Some(&crate::workbench::output_view::OUTPUT_VIEW_ID));+ });+ restarted.update_in(window_cx, |workbench, window, cx| workbench.move_view_container(EXPLORER_CONTAINER, Part::SideBar, window, cx));+ assert_eq!(stored(&profile)["viewContainerLocations"], json!({ "workbench.panel.output": 0 }));+}diff --git a/native/crates/app/src/workbench/view_panes.rs b/native/crates/app/src/workbench/view_panes.rsindex d37e175957a..ddab530220d 100644--- a/native/crates/app/src/workbench/view_panes.rs+++ b/native/crates/app/src/workbench/view_panes.rs@@ -362,8 +362,10 @@ impl Workbench {let explorer: Vec<_> = built_in.map(|id| (id, id != first && id != OPEN_EDITORS_VIEW)).chain(self.shown_tree_views().into_iter().map(|id| (id, true))).collect();self.layout_container(PaneContainer::Explorer, height, explorer, cx);self.limit_open_editors_pane();- if let Some(container) = self.side_bar_container().filter(|container| super::view_locations::is_generated_container(container)) {- self.layout_container(PaneContainer::Generated(container), height, Vec::new(), cx);+ if let Some(container) = self.side_bar_container().filter(|container| matches!(super::view_locations::pane_container(container), PaneContainer::Generated(_))) {+ // A panel container moved to the side bar draws its own views as the views moved into it.+ let own = self.views_in(container).into_iter().filter(|view| view.default_container == container && self.movable_view_shown(view)).map(|view| (view.id, false)).collect();+ self.layout_container(PaneContainer::Generated(container), height, own, cx);}let mut scm = Vec::new();// scm.contribution.ts: Repositories shows while `scm.providerCount` is not 0.@@ -399,6 +401,10 @@ impl Workbench {/// The container's own views still in it, then the views moved into it.fn layout_container(&mut self, container: PaneContainer, height: f32, own: Vec<(&'static str, bool)>, cx: &mut Context<Self>) {let id = container.container_id();+ // A container moved to a panel is laid out there (panel.rs `panel_container_content`).+ if self.container_location(id) != super::layout::Part::SideBar {+ return;+ }let mut views: Vec<_> = own.into_iter().filter(|(view, _)| self.stays_in(view, id)).collect();views.extend(self.moved_views_in(id));self.layout_panes(container, height, views, false, cx);diff --git a/port/ledger.md b/port/ledger.mdindex 67270278c39..dc4334da6c7 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -456,7 +456,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/services/userDataProfile | workbench service | M10 | verified | | one app-wide `UserDataProfilesService` (a gpui Global in app/src/user_data_profile.rs) for every window of the process: profile windows open in this process, a transient profile lives while a window runs it (userDataProfilesHandler.ts cleanup on close), and `onDidChangeProfiles` reaches every window (cargo test -p app workbench::user_data_profile: profile_windows_open_in_this_process, every_window_sees_a_profile_another_window_creates_and_removes); userDataProfileManagement.ts `switchProfile`, `removeProfile` and `changeCurrentProfile` (configuration, keybindings, global state and user extensions move to the profile's files, the extension host restarts, workbench/extension_host_restart.rs) in workbench/user_data_profile.rs; the configuration layers of a profile (`ApplicationConfiguration`, PROFILE_SCOPES, `workbench.settings.applyToAllProfiles`) with configurationService.test.ts's Profiles suite (cargo test -p config profile_tests); the settings, keybindings, tasks, snippets, globalState and extensions resources and the `.code-profile` template of userDataProfileImportExportService.ts as app/src/profile_template.rs (cargo test -p app profile_template); a template's extensions install the way extensionsResource.ts `apply` does, one publisher trust dialog for all of them and an error naming the ones that failed (cargo test -p app template_extensions_ask_for_publisher_trust_once); per-profile extensions.json (cargo test -p exthost extension_management); `createTroubleshootProfile` is removed with contrib/issue, its only caller (issueTroubleshoot.ts); profile templates from `profileTemplatesUrl` have no source, the product.json has none || workbench/services/userDataSync | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/services/utilityProcess | workbench service | | verified | | no utility process workers: the file watcher worker, the one kept client, is files/src/watcher.rs on an FSEvents thread (platform/files; api-tests `vscode API - workspace-watcher` passes in the milestone 20 whole-suite run); localTranscription is AI, removed (port/notes.md milestone 20) |-| workbench/services/views | workbench service | M11 | ported | [3 M] panel.rs:197: a view container moves only between the panel and the secondary side bar, by dragging its tab; upstream moves any container to the primary side bar too, and the tabs' and activity bar items' context menu has "Move To" (Primary Side Bar, Secondary Side Bar, Panel) and "Reset Location" (paneCompositeBar.ts `getCompositeActions`) | view containers of `viewsContainers.activitybar` and `viewsContainers.panel` and the tree views of every container (workbench/view_containers.rs): activity bar items while a view's `when` holds, `workbench.view.extension.<id>` with its "View: Show <title>" Command Palette item while `viewContainer.<id>.enabled` (cargo test -p app an_extension_container_is_shown), a panel container's tab after the built-in ones, its views as side-by-side panes under its "..." and "View: Toggle <title>" (cargo test -p app an_extension_panel_container_is_a_panel_tab), each contributed view's "<container>: Focus on <view> View" palette item (ui-pair port/fixtures/ui-pair/contributed-panes.json "palette" and "panel" match the reference but its Ports tab, removed by decision), `<view id>.focus`, `<view id>.active`, merged single views, view_panes.rs panes for the views of an extension container and of Testing (`PaneContainer::Contributed`: cargo test -p app view_containers::; ui-pair port/fixtures/ui-pair/contributed-panes.json with port/fixtures/extensions/contributed-panes, the Port Panes and Testing side bars as the reference), treeView.ts `noDataProviderMessage` (cargo test -p app tree_view::), contributed views of scm and debug as panes of those containers; the Explorer's ViewDescriptorsState (view_panes.rs); ui-pair port/results/references-view.md; `visibility` (`hidden` views stay out until the Views submenu of the Explorer's "..." shows them, `collapsed`; workbench/view_visibility.rs: cargo test -p app view_visibility); the Explorer container's ViewDescriptorsState (view_panes.rs); moving views (workbench/view_locations.rs, verified): `views.customizations` viewLocations and generated containers `workbench.views.service.<location>.<uuid>` with their activity bar items and panel tabs, View: Move View, Move Focused View, Reset Focused View Location, a view header dropped on another container's pane (at its position), on the activity bar or on a panel's title (a new entry), `focusedView`; the folder view, Open Editors, Outline, Timeline, Source Control's Changes, Search, the debug views and the panel's views move into any built-in container or a new entry and back, the moved view opens focused, the picker lists only visible views, a moved view's hidden state is in its current container's state (cargo test -p app a_moved_view_is_hidden); cargo test -p app (2594 passed); ui-pair port/fixtures/ui-pair/m11/move-view.json, port/results/move-view.md (8 steps match, Ports removed by decision); verified: ui-pair port/results/references-view.md (milestone 11 verification) |+| workbench/services/views | workbench service | M11 | ported | [3 M] panel.rs:189: `move_view_container` moves any container between the side bar, secondary side bar and panel and keeps the location on restart, but nothing calls it for the primary side bar: the tabs' and activity bar items' context menu lacks "Move To" (Primary Side Bar, Secondary Side Bar, Panel) and "Reset Location" (paneCompositeBar.ts `getCompositeActions`), a container's tab cannot be dropped on the activity bar nor an activity item on the panel or secondary side bar (compositeBar.ts), and ui-pair `contributed-panes.json` has no move step; [3 S] view_locations.rs:225: the Extensions and Testing containers do not move (`can_move_container`) | view containers of `viewsContainers.activitybar` and `viewsContainers.panel` and the tree views of every container (workbench/view_containers.rs): activity bar items while a view's `when` holds, `workbench.view.extension.<id>` with its "View: Show <title>" Command Palette item while `viewContainer.<id>.enabled` (cargo test -p app an_extension_container_is_shown), a panel container's tab after the built-in ones, its views as side-by-side panes under its "..." and "View: Toggle <title>" (cargo test -p app an_extension_panel_container_is_a_panel_tab), each contributed view's "<container>: Focus on <view> View" palette item (ui-pair port/fixtures/ui-pair/contributed-panes.json "palette" and "panel" match the reference but its Ports tab, removed by decision), `<view id>.focus`, `<view id>.active`, merged single views, view_panes.rs panes for the views of an extension container and of Testing (`PaneContainer::Contributed`: cargo test -p app view_containers::; ui-pair port/fixtures/ui-pair/contributed-panes.json with port/fixtures/extensions/contributed-panes, the Port Panes and Testing side bars as the reference), treeView.ts `noDataProviderMessage` (cargo test -p app tree_view::), contributed views of scm and debug as panes of those containers; the Explorer's ViewDescriptorsState (view_panes.rs); ui-pair port/results/references-view.md; `visibility` (`hidden` views stay out until the Views submenu of the Explorer's "..." shows them, `collapsed`; workbench/view_visibility.rs: cargo test -p app view_visibility); the Explorer container's ViewDescriptorsState (view_panes.rs); moving views (workbench/view_locations.rs, verified): `views.customizations` viewLocations and generated containers `workbench.views.service.<location>.<uuid>` with their activity bar items and panel tabs, View: Move View, Move Focused View, Reset Focused View Location, a view header dropped on another container's pane (at its position), on the activity bar or on a panel's title (a new entry), `focusedView`; the folder view, Open Editors, Outline, Timeline, Source Control's Changes, Search, the debug views and the panel's views move into any built-in container or a new entry and back, the moved view opens focused, the picker lists only visible views, a moved view's hidden state is in its current container's state (cargo test -p app a_moved_view_is_hidden); cargo test -p app (2594 passed); ui-pair port/fixtures/ui-pair/m11/move-view.json, port/results/move-view.md (8 steps match, Ports removed by decision); verified: ui-pair port/results/references-view.md (milestone 11 verification) || workbench/services/workingCopy | workbench service | M8 | verified | | the text file and untitled working copies are the editor models (dirty state, save, revert, the window's edited dot of `onDidChangeDirty`): cargo test -p app untitled (30), lifecycle (3); WorkingCopyFileService create, move, copy, delete with participants: cargo test -p files operations (12); WorkingCopyHistoryService and its tracker for saves into User/History, entries following renames and folder moves (`moveEntries`): cargo test -p app local_history (10); WorkingCopyBackupService and the backup tracker with hot exit (backups.rs, workbench/backup_tracker.rs), a backup of a deleted file restoring as an orphaned model (`doResolveFromBackup`), modified scratchpads backing up: cargo test -p app backup (19); the working copies of editable custom documents (MainThreadCustomEditorModel, workbench/custom_documents.rs: `$onDidEdit` edits for undo and redo with `$disposeEdits`, `$onContentChange`, dirty tabs, `$onSave`, Save As with `$onSaveAs` and the editor moved to the target, `$revert`, `$backup` into a `vscode-custom-editor` backup restored with its backup id): cargo test -p app custom_documents (3), and port/fixtures/extensions/custom-document-tests (FIXTURE=custom-document-tests port/tools/webview-check: 4/4 in the reference and 4/4 in the port). Notebook working copies are the contrib/notebook row's; their backups are typed (`hashIdentifier` with a type id, backups.rs: cargo test -p app backups::, the upstream typed hashes) and the shutdown joins backups still being written || workbench/services/workspaces | workbench service | M12 | ported | [3 L] workspace_editing.rs:243, :379: enterWorkspace reopens the window where upstream switches in place (L); the Remove Folder picker has no ROOT_FOLDER icons (S) | workspace_trust.rs: WorkspaceTrustManagementService (uriTrustInfo in shared storage, longest trusted parent, empty window memento, parent folder trust) and WorkspaceTrustRequestService: cargo test -p app workspace_trust; workbench/workspace_editing.rs: abstractWorkspaceEditingService.ts addFolders, removeFolders, updateFolders, saveAndEnterWorkspace, enterWorkspace (shortcut in port/notes.md: the window reopens in place), duplicate workspace: cargo test -p app folders_added_and_removed_in_a_workspace_reach_its_file_the_explorer_settings_and_host workspace_editing; ui-pair port/fixtures/ui-pair/m12/workspace-folders.json, verified at port-m12b-verify || workbench/contrib/accessibility | workbench contribution | M19 | verified | | workbench/accessible_view.rs and workbench/accessibility.rs: accessible view and accessibility help (Alt+F2, Alt+F1 with the editor, hover, view help providers, the hover's and a workbench hover's accessible view, Escape from the latter focusing the hover again, a focused contributed tree or webview view's `accessibilityHelpContent`, a webview view the `focusedView` while its webview has the keyboard; Alt+F6, Alt+H, Alt+K, Alt+A, Alt+]/[), notification aria labels with the verbosity hint, unfocused editor dimming, Toggle Screen Reader Accessibility Mode, status entry; cargo test -p app accessib (alt_f1_shows_the_editor_help..., alt_f1_in_a_contributed_view..., alt_f1_in_a_webview_view..., dimming), cargo test -p app content_hover (the hover's accessible view), port/tools/a11y-check reads the help text area (port/notes.md milestone 19) |