Visual Studio Code, rebuilt in Rust
Rust
fix(workspaces): enter a workspace in the same window
rokartur24b88856db6b
diff --git a/native/crates/app/src/workbench/backup_tracker.rs b/native/crates/app/src/workbench/backup_tracker.rsindex e371374b1e8..c435ccefdc1 100644--- a/native/crates/app/src/workbench/backup_tracker.rs+++ b/native/crates/app/src/workbench/backup_tracker.rs@@ -77,7 +77,7 @@ impl BackupTracker {}/// What the window's backup folder is: its workspace, its folder, or an empty window's folder.-enum BackupWorkspace<'a> {+pub(super) enum BackupWorkspace<'a> {Workspace { id: &'a str, config: &'a Path },Folder { id: &'a str, folder: &'a Path },/// An empty window takes its restored backup folder, else the first empty window backup of the last session,@@ -87,7 +87,7 @@ enum BackupWorkspace<'a> {/// `registerWorkspaceBackup`, `registerFolderBackup` and `registerEmptyWindowBackup`: the backup folder of the/// window, registered in `Backups/workspaces.json`.-fn backup_home(user_data: &Path, workspace: BackupWorkspace) -> PathBuf {+pub(super) fn backup_home(user_data: &Path, workspace: BackupWorkspace) -> PathBuf {let (key, entry, folder) = match workspace {BackupWorkspace::Workspace { id, config } => ("rootURIWorkspaces", json!({ "workspace": { "id": id, "configURIPath": file_uri(config) } }), id.to_owned()),BackupWorkspace::Folder { id, folder } => ("folders", json!({ "folderUri": file_uri(folder) }), id.to_owned()),diff --git a/native/crates/app/src/workbench/editor_groups/tests.rs b/native/crates/app/src/workbench/editor_groups/tests.rsindex ce04c759763..922ae9e4b36 100644--- a/native/crates/app/src/workbench/editor_groups/tests.rs+++ b/native/crates/app/src/workbench/editor_groups/tests.rs@@ -297,13 +297,7 @@ fn folders_dropped_from_outside_enter_an_untitled_workspace(cx: &mut TestAppContlet shared_storage = std::sync::Arc::new(std::sync::Mutex::new(storage::Storage::in_memory()));cx.set_global(crate::AppState { args: Vec::new(), runtime: exthost::Runtime::Bun, user_data: user_data.clone(), app_root: dir.clone(), builtins: Vec::new(), user_extensions_folder: dir.join("extensions"), shared_storage });});- // A session that never ends holds back the new window, which needs the profiles service and an extension host.- let (session, ended) = futures::channel::oneshot::channel::<()>();- std::mem::forget(session);- let target = workbench.update(cx, |workbench, _| {- workbench.lifecycle.session_ended = Some(ended);- workbench.editor_group_id()- });+ let target = workbench.update(cx, |workbench, _| workbench.editor_group_id());workbench.update_in(cx, |workbench, window, cx| workbench.drop_external_paths(folders.to_vec(), target, window, cx));let untitled: Vec<PathBuf> = std::fs::read_dir(user_data.join("Workspaces")).unwrap().map(|entry| entry.unwrap().path().join("workspace.json")).collect();assert_eq!(untitled.len(), 1);diff --git a/native/crates/app/src/workbench/extension_host_restart.rs b/native/crates/app/src/workbench/extension_host_restart.rsindex 9ea9c2a2ae6..9abc1089421 100644--- a/native/crates/app/src/workbench/extension_host_restart.rs+++ b/native/crates/app/src/workbench/extension_host_restart.rs@@ -36,12 +36,17 @@ impl Workbench {/// `stopExtensionHosts` then `startExtensionHosts`, with the user extensions of the current profile.pub(crate) fn restart_extension_host(&mut self, window: &mut Window, cx: &mut Context<Self>) {self.stop_extension_host(cx);+ self.start_extension_hosts(window, cx);+ }++ /// `startExtensionHosts`: a new host with the window's extensions to run.+ pub(super) fn start_extension_hosts(&mut self, window: &mut Window, cx: &mut Context<Self>) {let extensions = self.extensions_to_run();self.set_running_extensions_after_restart(extensions.clone(), cx);self.start_extension_host(extensions, window, cx);}- fn stop_extension_host(&mut self, cx: &mut Context<Self>) {+ pub(super) fn stop_extension_host(&mut self, cx: &mut Context<Self>) {self.host.stop_extension_host();// MainThreadCommands: the commands the host registered.for (id, registration) in std::mem::take(&mut self.extension_commands) {@@ -108,6 +113,11 @@ impl Workbench {/// The channels, session thread and workbench loops of a new host, as main.rs starts the first one.fn start_extension_host(&mut self, extensions: Vec<ScannedExtension>, window: &mut Window, cx: &mut Context<Self>) {+ // A host process needs bun and a built app root, and its threads would wake the test scheduler.+ if cfg!(test) {+ self.extension_host_started(cx);+ return;+ }let (status, mut status_lines) = unbounded::<String>();let (host_sender, host_receiver) = channel();let (request_sender, requests) = unbounded::<ForwardedRequest>();diff --git a/native/crates/app/src/workbench/lifecycle.rs b/native/crates/app/src/workbench/lifecycle.rsindex 612d6fabf8c..f6535365dcc 100644--- a/native/crates/app/src/workbench/lifecycle.rs+++ b/native/crates/app/src/workbench/lifecycle.rs@@ -116,10 +116,7 @@ impl Workbench {cx.spawn_in(window, async move |workbench, cx| {if veto.await == Ok(false) {let _ = workbench.update_in(cx, |workbench, window, cx| {- // storageService's `onWillSaveState` on shutdown: a webview's state changes without an editor change.- workbench.save_editor_part_state();- workbench.save_suggest_memory();- workbench.save_code_lens_cache();+ workbench.will_save_state();then(workbench, window, cx)});}@@ -127,6 +124,14 @@ impl Workbench {.detach();}+ /// storageService's `onWillSaveState`, on shutdown and before a storage switch: a webview's state changes without+ /// an editor change.+ pub(super) fn will_save_state(&mut self) {+ self.save_editor_part_state();+ self.save_suggest_memory();+ self.save_code_lens_cache();+ }+/// The `onBeforeShutdown` vetoes of this window: true when one vetoed. A shutdown asked while another runs is/// vetoed, one runs at a time.fn veto_shutdown(&mut self, reason: ShutdownReason, window: &mut Window, cx: &mut Context<Self>) -> oneshot::Receiver<bool> {diff --git a/native/crates/app/src/workbench/workspace_editing.rs b/native/crates/app/src/workbench/workspace_editing.rsindex 68a44560a09..b84d3e10ebd 100644--- a/native/crates/app/src/workbench/workspace_editing.rs+++ b/native/crates/app/src/workbench/workspace_editing.rs@@ -6,11 +6,13 @@ use std::path::{Path, PathBuf};use std::time::Duration;use config::configuration::Overrides;+use config::registry::Scope;use config::workspace::{UNTITLED_WORKSPACE_NAME, Workspace, is_untitled_workspace, rewrite_for_new_location, stored_folder, updated_folders};use gpui::{AsyncWindowContext, Context, PromptLevel, WeakEntity, Window};use serde_json::{Value, json};use super::Workbench;+use super::backup_tracker::{BackupWorkspace, backup_home};use super::file_dialogs::WORKSPACE_FILTER;use super::lifecycle::ShutdownReason;use crate::commands::Outcome;@@ -239,38 +241,56 @@ impl Workbench {Ok(())}- /// `enterWorkspace`: this window's editors are backed up and its workspace storage copied for the workspace,- /// then the window opens again on it in the same place.- // shortcut: the window reopens where upstream switches the storage, the backups and the extension host in place;- // the editors and view state come back from the copied storage and backups.+ /// nativeWorkspaceEditingService.ts `enterWorkspace`: the extension host stops, the window's configuration,+ /// backups and storage move to the workspace in place (`doEnterWorkspace`, workspacesManagementMainService.ts+ /// `doEnterWorkspace`, `storageService.switch(workspace, true)`), then the host starts again on it.fn enter_workspace(&mut self, file: PathBuf, window: &mut Window, cx: &mut Context<Self>) {- self.backup_before_shutdown();+ self.stop_extension_host(cx);+ let old_workspace = self.workspace().cloned();+ let workspace = Workspace::open(file.clone());+ if old_workspace.as_ref().is_some_and(|workspace| workspace.file.is_none())+ && let Err(error) = self.copy_workspace_settings(&file, |scope| scope == Scope::Window)+ {+ self.notify_error(error);+ }+ let before = self.model_creation_options();+ let change = self.settings.lock().unwrap().set_workspace(workspace.clone());+let user_data = cx.global::<crate::AppState>().user_data.clone();- let old_backups = self.lifecycle.backups.home.clone();- let storage = self.workspace_storage.clone();- let ended = self.lifecycle.session_ended.take();- let workspace = Workspace::open(file);let id = exthost::session::workspace_id(&workspace);- let request = WindowRequest { workspace: Some(workspace), ui: Some(crate::windows_state::ui_state(window, cx)), ..WindowRequest::default() };- self.lifecycle.window_closed = true;- window.remove_window();- cx.spawn(async move |_, cx| {- if let Some(ended) = ended {- let _ = ended.await;- }- let target = user_data.join("User/workspaceStorage").join(&id);- if let Err(error) = copy_storage(&storage.lock().unwrap(), &target) {- eprintln!("[workspaces] copying the workspace storage to {}: {error}", target.display());- }- if let Some(old) = old_backups.filter(|old| old.exists()) {- let new = user_data.join("Backups").join(&id);- if let Err(error) = move_backups(&user_data, &old, &new) {- eprintln!("[workspaces] moving the backups to {}: {error}", new.display());- }+ self.backup_before_shutdown();+ if let Some(old_backups) = self.lifecycle.backups.home.take() {+ let new_backups = backup_home(&user_data, BackupWorkspace::Workspace { id: &id, config: &file });+ if old_backups.exists()+ && let Err(error) = move_backups(&user_data, &old_backups, &new_backups)+ {+ eprintln!("[workspaces] moving the backups to {}: {error}", new_backups.display());}- let _ = cx.update(|cx| open_window_or_log(request, cx));- })- .detach();+ self.lifecycle.backups.home = Some(new_backups);+ }+ if let Some(old_file) = old_workspace.and_then(|workspace| workspace.file) {+ delete_untitled_workspace(&user_data, &old_file);+ }+ self.will_save_state();+ let target = user_data.join("User/workspaceStorage").join(&id);+ let switched = copy_storage(&self.workspace_storage.lock().unwrap(), &target);+ match switched {+ Ok(storage) => *self.workspace_storage.lock().unwrap() = storage,+ Err(error) => eprintln!("[workspaces] copying the workspace storage to {}: {error}", target.display()),+ }++ // explorerView.ts `setTreeInput`: a new input without view state, its first five roots expanded.+ self.folder = Some(crate::explorer::FileTree::new(workspace.clone(), self.settings.clone()));+ self.workspace_folders_changed(&change, before, None, cx);+ let empty_window_trusted = self.setting("security.workspace.trust.emptyWindow") == true;+ if self.workspace_trust.set_workspace(&workspace, &mut self.workspace_storage.lock().unwrap(), empty_window_trusted) {+ let before = self.model_creation_options();+ let change = self.settings.lock().unwrap().update_workspace_trust(self.workspace_trust.is_trusted());+ self.configuration_changed(&change, before, cx);+ }+ // workspacesHistoryMainService.ts: entering a workspace adds it to the recently opened.+ crate::add_recently_opened(&mut self.shared_storage.lock().unwrap(), Some(&workspace), std::iter::empty());+ self.start_extension_hosts(window, cx);}/// DuplicateWorkspaceInNewWindowAction: an untitled workspace with this window's folders and its workspace@@ -282,20 +302,20 @@ impl Workbench {Ok(file) => file,Err(error) => return self.notify_error(error.to_string()),};- if let Err(error) = self.copy_workspace_settings(&file) {+ if let Err(error) = self.copy_workspace_settings(&file, |scope| !config::registry::APPLICATION_SCOPES.contains(&scope)) {self.notify_error(error);}let request = WindowRequest { workspace: Some(Workspace::open(file)), ..WindowRequest::default() };cx.defer(move |cx| open_window_or_log(request, cx));}- /// `copyWorkspaceSettings`: the workspace values of every registered setting that is not application scoped.- fn copy_workspace_settings(&self, file: &Path) -> Result<(), String> {+ /// `doCopyWorkspaceSettings`: the workspace values of the registered settings whose scope `keep` takes.+ fn copy_workspace_settings(&self, file: &Path, keep: impl Fn(Scope) -> bool) -> Result<(), String> {let settings = self.settings.lock().unwrap();let mut copied = serde_json::Map::new();for key in &settings.configuration.workspace.keys {let Some(property) = settings.registry.property(key) else { continue };- if config::registry::APPLICATION_SCOPES.contains(&property.scope) {+ if !keep(property.scope) {continue;}copied.insert(key.clone(), settings.configuration.workspace.get_value(Some(key)).unwrap_or(Value::Null));@@ -491,13 +511,13 @@ fn is_own_untitled_workspace(user_data: &Path, file: &Path) -> bool {}/// `storageService.switch(workspace, preserveData)`: every item of this window's workspace storage in the new one.-fn copy_storage(from: &storage::Storage, folder: &Path) -> std::io::Result<()> {+fn copy_storage(from: &storage::Storage, folder: &Path) -> std::io::Result<storage::Storage> {std::fs::create_dir_all(folder)?;let mut target = storage::Storage::open(&folder.join("state.vscdb"));for (key, value) in from.items() {target.set(key, value.clone());}- Ok(())+ Ok(target)}/// backupMainService.ts `moveBackupFolder`: the backups of the window's old workspace move to the new one; backupsdiff --git a/native/crates/app/src/workbench/workspace_editing/tests.rs b/native/crates/app/src/workbench/workspace_editing/tests.rsindex 680a9e9ef1a..07a2dad1660 100644--- a/native/crates/app/src/workbench/workspace_editing/tests.rs+++ b/native/crates/app/src/workbench/workspace_editing/tests.rs@@ -52,3 +52,53 @@ fn folders_added_and_removed_in_a_workspace_reach_its_file_the_explorer_settingsworkbench.update(cx, |workbench, cx| workbench.reload_changed_settings_files(cx));assert_eq!(folder_names(cx), ["a", "c"], "an edit of the workspace file on disk changes the folders");}++/// nativeWorkspaceEditingService.ts `enterWorkspace`: a folder added to a folder window enters an untitled workspace+/// in the same window, its storage carried over and the extension host restarted; Save Workspace As then enters the+/// saved file and deletes the untitled one.+#[gpui::test]+fn adding_a_folder_enters_an_untitled_workspace_in_the_same_window(cx: &mut TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let theme = load_theme(&[scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap()], "Dark Modern").unwrap();+ let dir = std::env::temp_dir().join(format!("vsrustium-enter-workspace-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&dir);+ for folder in ["user-data/User", "a", "b", "extensions"] {+ std::fs::create_dir_all(dir.join(folder)).unwrap();+ }+ let user_data = dir.join("user-data");+ let workspace = Workspace::folder(dir.join("a"));+ let settings = Arc::new(Mutex::new(Settings::load(Registry::with_extensions(&[]), user_data.join("User"), Some(workspace.clone()))));+ let (sender, messages) = std::sync::mpsc::channel();+ cx.update(|cx| {+ let shared_storage = Arc::new(Mutex::new(storage::Storage::in_memory()));+ cx.set_global(crate::AppState { args: Vec::new(), runtime: exthost::Runtime::Bun, user_data: user_data.clone(), app_root: dir.clone(), builtins: Vec::new(), user_extensions_folder: dir.join("extensions"), shared_storage });+ });+ let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), Some(workspace), Languages::new(&[]), settings.clone(), HostSync::new(sender), cx));+ workbench.update(cx, |workbench, _| workbench.workspace_storage.lock().unwrap().set("memento/sample", "kept".into()));+ cx.run_until_parked();+ _ = messages.try_iter().count();++ let added = workbench.update_in(cx, |workbench, window, cx| workbench.add_workspace_folders(vec![(dir.join("b"), None)], None, window, cx));+ assert_eq!(added, Ok(()));+ let (file, folders, title) = workbench.read_with(cx, |workbench, _| {+ let workspace = workbench.workspace().unwrap();+ (workspace.file.clone(), workspace.folders.iter().map(|folder| folder.path.clone()).collect::<Vec<_>>(), workbench.window_title())+ });+ let untitled = file.expect("the window entered a workspace");+ assert!(untitled.starts_with(user_data.join("Workspaces")), "{}", untitled.display());+ assert_eq!(folders, [dir.join("a"), dir.join("b")]);+ assert_eq!(title, "Untitled (Workspace)");+ assert_eq!(settings.lock().unwrap().workspace.as_ref().and_then(|workspace| workspace.file.clone()), Some(untitled.clone()));+ assert!(messages.try_iter().any(|message| message.method == "stopExtensionHost"), "the old extension host was stopped");+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.extension_host_starts), 1, "a new extension host started");+ let id = exthost::session::workspace_id(&Workspace::open(untitled.clone()));+ let stored = storage::Storage::open(&user_data.join("User/workspaceStorage").join(&id).join("state.vscdb"));+ assert_eq!(stored.get("memento/sample"), Some("kept"), "the workspace storage moved with its data");++ let target = dir.join("saved.code-workspace");+ workbench.update_in(cx, |workbench, window, cx| workbench.save_workspace_as(target.clone(), window, cx));+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.workspace().unwrap().file.clone()), Some(target.clone()));+ assert_eq!(workbench.read_with(cx, |workbench, _| workbench.window_title()), "saved (Workspace)");+ assert!(!untitled.exists(), "entering the saved workspace deletes the untitled one");+ assert_eq!(cx.update(|_, cx| cx.windows().len()), 1);+}diff --git a/native/crates/app/src/workspace_trust.rs b/native/crates/app/src/workspace_trust.rsindex e78c255fb5c..176d6aaa075 100644--- a/native/crates/app/src/workspace_trust.rs+++ b/native/crates/app/src/workspace_trust.rs@@ -58,8 +58,7 @@ impl Default for WorkspaceTrust {impl WorkspaceTrust {pub fn new(shared: Arc<Mutex<Storage>>, startup: Startup) -> WorkspaceTrust {let entries = load_entries(&shared.lock().unwrap());- let mut workspace_uris: Vec<PathBuf> = startup.workspace.iter().flat_map(|workspace| workspace.folders.iter().map(|folder| folder.path.clone())).collect();- workspace_uris.extend(startup.workspace.and_then(|workspace| workspace.file.clone()));+ let workspace_uris = workspace_uris(startup.workspace);let mut trust = WorkspaceTrust { enabled: startup.enabled, shared, entries, workspace_uris, trusted: false, requests: Vec::new(), startup_prompt_open: false };trust.trusted = trust.calculate(startup.workspace_storage, startup.empty_window_trusted);if trust.enabled && trust.is_empty(startup.workspace_storage) && memento(startup.workspace_storage)["isEmptyWorkspaceTrusted"].is_null() {@@ -111,6 +110,13 @@ impl WorkspaceTrust {self.set_uris_trust(&uris, trusted, workspace_storage, empty_window_trusted)}+ /// `onDidChangeWorkspaceFolders`: `updateWorkspaceTrust` for the window's new folders and workspace file. True+ /// when the window's trust changed.+ pub fn set_workspace(&mut self, workspace: &Workspace, workspace_storage: &mut Storage, empty_window_trusted: bool) -> bool {+ self.workspace_uris = workspace_uris(Some(workspace));+ self.update(None, workspace_storage, empty_window_trusted)+ }+/// `setParentFolderTrust`.pub fn set_parent_folder_trust(&mut self, trusted: bool, workspace_storage: &mut Storage, empty_window_trusted: bool) -> bool {let Some(parent) = self.parent_folder().map(Path::to_owned) else { return false };@@ -170,6 +176,13 @@ impl WorkspaceTrust {}}+/// `getWorkspaceUris`: the folders, then the workspace file.+fn workspace_uris(workspace: Option<&Workspace>) -> Vec<PathBuf> {+ let mut uris: Vec<PathBuf> = workspace.iter().flat_map(|workspace| workspace.folders.iter().map(|folder| folder.path.clone())).collect();+ uris.extend(workspace.and_then(|workspace| workspace.file.clone()));+ uris+}+/// extensionEnablementService.ts `_isDisabledByWorkspaceTrust` in an untrusted window: an extension inside the/// workspace, or one whose `getExtensionUntrustedWorkspaceSupportType` is `false`. `configured` is the/// `extensions.supportUntrustedWorkspaces` setting; the product overrides none. `filterEnabledExtensions` neverdiff --git a/native/crates/config/src/service.rs b/native/crates/config/src/service.rsindex 113e29e0333..955a9e95aa5 100644--- a/native/crates/config/src/service.rs+++ b/native/crates/config/src/service.rs@@ -159,6 +159,30 @@ impl Settings {Ok(self.set_workspace_folders(Workspace::from_file(file).folders))}+ /// `initialize` with another workspace (workspaceEditingService.ts `doEnterWorkspace`): the folder and workspace+ /// layers read for `workspace`, a folder's with the scopes of its new workbench state.+ pub fn set_workspace(&mut self, workspace: Workspace) -> Change {+ let before = self.configuration.clone();+ let folders: Vec<PathBuf> = workspace.folders.iter().map(|folder| folder.path.clone()).collect();+ self.workspace = Some(workspace);+ self.configuration.has_workspace = true;+ self.configuration.folders = folders.into_iter().map(|folder| (folder.clone(), self.load_folder(&folder))).collect();+ self.configuration.workspace = self.load_workspace();+ self.configuration.layers_changed();+ self.stamps = self.watched_files().into_iter().map(|path| (path.clone(), stamp(&path))).collect();+ let mut changes = vec![compare(Some(&before.workspace), Some(&self.configuration.workspace))];+ for (folder, model) in &before.folders {+ let now = self.configuration.folders.iter().find(|(path, _)| path == folder).map(|(_, model)| model);+ changes.push(compare(Some(model), now));+ }+ for (folder, model) in &self.configuration.folders {+ if !before.folders.iter().any(|(path, _)| path == folder) {+ changes.push(compare(None, Some(model)));+ }+ }+ merge_changes(&changes)+ }+/// `onFoldersChanged`: the settings layers of removed folders go, those of added folders are read.fn set_workspace_folders(&mut self, folders: Vec<crate::workspace::WorkspaceFolder>) -> Change {let Some(workspace) = self.workspace.as_mut() else { return Change::default() };diff --git a/port/ledger.md b/port/ledger.mdindex 848891c8142..7f34fa59936 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -458,7 +458,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| 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 S] activity_bar_menu.rs:113: an activity item's or tab's context menu lacks Configure Keybinding, Hide/Keep '{name}' and Show/Hide Badge above Move To (compositeBarActions.ts `showContextMenu`; ui-pair contributed-panes.json "item-menu"), and a panel or secondary side bar tab's menu lacks its bar's own actions (panelPart.ts `fillExtraContextMenuActions`); [3 S] panel.rs:189: a composite dropped on another bar goes to that bar's end, not the drop index (compositeBar.ts `getTargetIndex`), one dropped on its own bar does not reorder (`moveComposite`), and the moved container opens without focus (`openComposite(id, true)`; ui-pair contributed-panes.json "moved": the reference puts Port Panes before Terminal and focuses its first pane); [3 S] activity_bar_menu.rs:153: an activity item drags as its title, the reference as its icon; [3 S] side_bar.rs:62: the compact activity bar's tabs have no item menu and no drag; [3 S] view_panes.rs:535: a collapsed pane of a container in the panel draws expanded, the reference as a narrow strip (ui-pair contributed-panes.json "moved", Third); [3 S] panel.rs:553: after a composite drop the tab under the pointer shows its hover, the reference none (contributed-panes.json "moved"); [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); an activity item's and a tab's context menu with Move To (the other locations) and Reset Location away from the default location or for a lone view at home (paneCompositeBar.ts `getContextMenuActionsForComposite`: cargo test -p app the_explorer_item_menu), an activity item dragged onto the panel or secondary side bar and a tab dropped on the activity bar (compositeBar.ts `CompositeDragAndDrop.drop`: cargo test -p app the_explorer_item_drags; ui-pair contributed-panes.json "moved": Port Panes moves into the panel and opens in both); 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/services/workspaces | workbench service | M12 | ported | [3 S] workspace_editing.rs:400: the Remove Folder picker has no ROOT_FOLDER icons<br>[3 S] workspace_editing.rs:174, :231: a non-default profile is not set for a new untitled or saved workspace (abstractWorkspaceEditingService.ts `setProfileForWorkspace`) | 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 in the same window (stopped and started host, settings, backups, storage, Explorer, title), duplicate workspace: cargo test -p app folders_added_and_removed_in_a_workspace_reach_its_file_the_explorer_settings_and_host adding_a_folder_enters_an_untitled_workspace_in_the_same_window 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) || workbench/contrib/accessibilitySignals | workbench contribution | M19 | verified | | saveAccessibilitySignal.ts, editorTextPropertySignalsContribution.ts (line and position signals, state changes under the cursor, delays, breakpoints on the line), List Signal Sounds/Announcements; cargo test -p app accessib (errors_are_announced_on_a_new_line_and_at_each_position_on_them) || workbench/contrib/agentsVoice | workbench contribution | | removed | | no sign-in/AI by decision (port/notes.md); not ported |diff --git a/port/notes.md b/port/notes.mdindex b8db209e834..54f9318eae8 100644--- a/port/notes.md+++ b/port/notes.md@@ -389,7 +389,7 @@ Scope shipped so far: `workspace.fs` and file events, Seti file icons and numeri- `workbench.action.files.showOpenedFileInNewWindow` starts another app process on the active file; `code-gpui <file>` (a path that is neither a folder nor a `.code-workspace` file) opens an empty window with the file, as windowsMainService.ts does.- Command sweep of workbench/contrib/files against the port: `workbench.action.files.saveEditors` and `revertEditors` are ids of notification actions, not commands (n/a); `explorer.download` and `explorer.upload` are web and remote only (n/a). Owned by code merged in port-integrate after this branch's base (e9ae1460): Save As, Save without Formatting, Toggle Auto Save, `textFileSaveErrorHandler` and the elevated write (milestone 8 text files), the empty Explorer view (milestone 11). Wait for that code here: the compare commands (`compareFiles`, `compareSelected`, `selectForCompare`, `compareFileWith`, `compareNewUntitledTextFiles`, `compareWithClipboard`, `compareWithSaved`) need the milestone 14 diff editor; the Open Editors view (`focusOpenEditorsView`, `openEditors.closeAll`, `openEditors.newUntitledFile`, `saveAllInGroup`, `closeGroup`) needs the milestone 11 view panes. Wait for section 11 services still `todo`: `explorer.openToSide` and `toggleEditorGroupLayout` (editor groups), `explorer.openWith` (the editor resolver), the dirty files badge (the activity service), the Explorer decorations for symlinks and unresolvable roots (the decorations service), the binary, missing file and folder placeholders of textFileEditor.ts with their actions `workbench.files.action.openFolder`, `workbench.files.action.reveal` and `workbench.files.action.createMissingFile` (the editor placeholder). `workbench.files.openFile` is only a telemetry event id (n/a).- Workspace folder editing (`workbench/workspace_editing.rs`; workspaceEditingService.ts browser and electron-browser, configurationService.ts `doUpdateFolders`, workspacesManagementMainService.ts `createUntitledWorkspace`): `updateFolders`, `addFolders` and `removeFolders` write the workspace file's `folders` through jsonEdit (paths relative to the file where possible, `getStoredWorkspaceFolder`), then the window follows in place: the Explorer roots, the folder settings layers (`Settings::write_workspace_folders`), the host's `$acceptWorkspaceData` and its search folders, the file watcher, and a host restart when the first folder changed (`WorkspaceChangeExtHostRelauncher`, not while extension tests run). An edit of the workspace file on disk takes the same path. In a folder or empty window, adding (or replacing or removing the folder) creates an untitled workspace `<user data>/Workspaces/<id>/workspace.json` ("Untitled (Workspace)", not in the recent list) and enters it. Commands: `addRootFolder` and Add Folder to Workspace (dialog "Add Folder to Workspace", Add), Remove Folder from Workspace (picker "Select workspace folder"), `removeRootFolder` on the Explorer's roots, Save Workspace As (`pickNewWorkspacePath`, `rewriteWorkspaceFileForNewLocation`, trust of the new file, "Unable to save workspace" when another window has it), Duplicate Workspace (`copyWorkspaceSettings`); File menu group `3_workspace` and the Explorer context group `2_workspace`. `$updateWorkspaceFolders` shows the "Extension '{0}' added 1 folder to the workspace" status for 10 s. Closing or leaving an untitled workspace asks "Do you want to save your workspace configuration as a file?" (`window.confirmSaveUntitledWorkspace`, the "Always discard" checkbox). A dropped folder's "Add Folder to Workspace" adds it. Tests: `cargo test -p config workspace::`, `cargo test -p app workspace_editing`.-- shortcut: entering a workspace reopens the window in its place where upstream switches the storage, backups and extension host in place: modified editors are backed up into the new workspace's backups and the workspace storage is copied (`storageService.switch(preserveData)`), so the editors and their state come back. A non-default profile is not associated with the new untitled workspace (`setProfileForWorkspace`).+- Entering a workspace switches the window in place as nativeWorkspaceEditingService.ts `enterWorkspace`: the extension host stops, the settings read the workspace's layers, the backups move (`moveBackupFolder`), the workspace storage is copied (`storageService.switch(preserveData)`), the Explorer, trust and recently opened follow, then the host starts again. Tests count the host start without a host process (`start_extension_host` under `cfg!(test)`). A non-default profile is not associated with the new untitled workspace (`setProfileForWorkspace`), a gap on the ledger row.- shortcut: the folder picker of Remove Folder from Workspace shows no ROOT_FOLDER icon; Seti, the default file icon theme, has no folder icons.- An empty area Explorer press stands for the only root (`onContextMenu`): its resource keys apply, so Reveal in Finder, Open Timeline, Copy Path and Copy Relative Path show there as in the reference.- Compare commands (`workbench/file_compare.rs`, fileCommands.ts and fileActions.ts): Compare Active File with Saved (Cmd+K D; the `showModifications` side holds the file as on disk, label "{name} (in file) ↔ {name}"), Select for Compare and Compare with Selected (`resourceSelectedForCompare`), Compare Selected (two Explorer rows, `listDoubleSelection`), Compare Active File With... (Quick Open with its second item active, `ItemActivation.SECOND`; the picked file is the modified side), Compare Active File with Clipboard (Cmd+K C, `clipboardCompare<n>` side, "Clipboard ↔ {name}"), Compare New Untitled Text Files; Explorer context group `3_compare`. Test: `cargo test -p app file_compare`.diff --git a/port/tools/ui-pair b/port/tools/ui-pairindex 01c5adcb667..eb135553245 100755--- a/port/tools/ui-pair+++ b/port/tools/ui-pair@@ -280,8 +280,7 @@ async function otherWindow(main: { pid: number; window_id: number }) {async function shot(app: string, pid: number, windowId: number, name: string) {type Listed = { window_id: number; is_on_screen: boolean; bounds: { width: number } };const { windows } = await cua('list_windows', { pid });- // The port reopens its window when it enters a workspace: then the new 1024 wide window is the main one.- const main = windows.some((w: Listed) => w.window_id === windowId && w.is_on_screen) ? windowId : windows.find((w: Listed) => w.is_on_screen && w.bounds.width === 1024)?.window_id ?? windowId;+ const main = windowId;const sheet = windows.find((w: Listed) => w.is_on_screen && w.window_id !== main && w.bounds.width < 1024 && !otherWindowIds.has(w.window_id) && !otherWindowIds.has(main));const file = resolve(outDir, `${app}-${name}.png`);await cua('get_window_state', { pid, window_id: sheet?.window_id ?? main, include_accessibility_tree: false, max_image_dimension: 2048, screenshot_out_file: file });