Visual Studio Code, rebuilt in Rust
Rust
feat(workspaces): show root folder icons in the Remove Folder picker
rokarturab6162bb46b5
diff --git a/native/crates/app/src/quick_input.rs b/native/crates/app/src/quick_input.rsindex 31cffe1ecb2..f53e98115df 100644--- a/native/crates/app/src/quick_input.rs+++ b/native/crates/app/src/quick_input.rs@@ -104,6 +104,8 @@ pub struct Item {pub file_icon: Option<PathBuf>,/// `FileKind.FOLDER` for `file_icon`: the folder icon of the theme.pub folder_icon: bool,+ /// `FileKind.ROOT_FOLDER` for `file_icon`: the root folder icon of the theme.+ pub root_folder_icon: bool,/// `iconClasses` of a language (`getIconClassesForLanguageId`).pub language_icon: Option<String>,pub buttons: Vec<Button>,diff --git a/native/crates/app/src/workbench/quick_input_view.rs b/native/crates/app/src/workbench/quick_input_view.rsindex c1b97b5f584..e9d5bd9b902 100644--- a/native/crates/app/src/workbench/quick_input_view.rs+++ b/native/crates/app/src/workbench/quick_input_view.rs@@ -868,7 +868,7 @@ impl Workbench {};line.child(icon.mr(px(6.)))})- .children(row.item.file_icon.as_ref().and_then(|path| self.quick_input_file_icon(path, row.item.folder_icon, icon_color)))+ .children(row.item.file_icon.as_ref().and_then(|path| self.quick_input_file_icon(path, row.item.folder_icon, row.item.root_folder_icon, icon_color))).children(row.item.language_icon.as_ref().and_then(|language| {let icon = self.file_icons.as_ref()?.language_icon(language, self.theme.kind, 13., ROW_HEIGHT, icon_color)?;Some(icon.mr(px(6.)))@@ -1021,10 +1021,10 @@ impl Workbench {}/// iconlabel.css `.monaco-icon-label::before`: 16px wide, 22px tall, 6px before the label.- fn quick_input_file_icon(&self, path: &Path, folder: bool, foreground: Rgba) -> Option<Div> {+ fn quick_input_file_icon(&self, path: &Path, folder: bool, is_root: bool, foreground: Rgba) -> Option<Div> {let icons = self.file_icons.as_ref()?;- let icon = match folder {- true => icons.folder_icon(crate::file_icons::FolderIcon { path: &path, is_root: false, expanded: false }, self.theme.kind, 13., ROW_HEIGHT, foreground)?,+ let icon = match folder || is_root {+ true => icons.folder_icon(crate::file_icons::FolderIcon { path: &path, is_root, expanded: false }, self.theme.kind, 13., ROW_HEIGHT, foreground)?,false => icons.file_icon(path, self.languages.language_of(path, ""), self.theme.kind, 13., ROW_HEIGHT, foreground)?,};Some(icon.mr(px(6.)))diff --git a/native/crates/app/src/workbench/workspace_editing.rs b/native/crates/app/src/workbench/workspace_editing.rsindex e8b8dfa9389..37a3317cb80 100644--- a/native/crates/app/src/workbench/workspace_editing.rs+++ b/native/crates/app/src/workbench/workspace_editing.rs@@ -407,8 +407,7 @@ impl Workbench {for (index, folder) in workspace.folders.iter().enumerate() {let parent = folder.path.parent().map(|parent| path_label(parent, Some(&workspace))).unwrap_or_default();let description = (parent != folder.name).then_some(parent);- // shortcut: no ROOT_FOLDER icon classes; Seti, the default theme, has no folder icons, others would show one.- entries.push(Entry::Item(Item { handle: index as i64, label: folder.name.clone(), description, ..Item::default() }));+ entries.push(Entry::Item(Item { handle: index as i64, label: folder.name.clone(), description, file_icon: Some(folder.path.clone()), root_folder_icon: true, ..Item::default() }));}let mut input = QuickInput::new(0, Kind::QuickPick);input.placeholder = Some("Select workspace folder".into());diff --git a/native/crates/app/src/workbench/workspace_editing/tests.rs b/native/crates/app/src/workbench/workspace_editing/tests.rsindex 6c90e6384c8..3c9f9fa0bd8 100644--- a/native/crates/app/src/workbench/workspace_editing/tests.rs+++ b/native/crates/app/src/workbench/workspace_editing/tests.rs@@ -51,6 +51,21 @@ fn folders_added_and_removed_in_a_workspace_reach_its_file_the_explorer_settingsstd::fs::write(&file, r#"{ "folders": [{ "path": "a" }, { "path": "c" }] }"#).unwrap();workbench.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");++ // workspaceCommands.ts PICK_WORKSPACE_FOLDER_COMMAND_ID: each folder shows the theme's ROOT_FOLDER icon.+ let icons = workbench.update_in(cx, |workbench, window, cx| {+ workbench.execute_command("workbench.action.removeRootFolder", Vec::new(), window, cx);+ let picker = workbench.quick_inputs.current().expect("the folder picker shows");+ assert_eq!(picker.placeholder.as_deref(), Some("Select workspace folder"));+ let mut icons = Vec::new();+ for entry in picker.items() {+ if let crate::quick_input::Entry::Item(item) = entry {+ icons.push((item.file_icon.clone(), item.root_folder_icon));+ }+ }+ icons+ });+ assert_eq!(icons, [(Some(dir.join("a")), true), (Some(dir.join("c")), true)]);}/// nativeWorkspaceEditingService.ts `enterWorkspace`: a folder added to a folder window enters an untitled workspacediff --git a/port/ledger.md b/port/ledger.mdindex e6d46a99b48..02fac9f40ab 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] keyboard.rs:597: the Extensions views' key context (`inputBoxFocus`, `listFocus`) applies only while they are in the side bar, not in a panel; [3 S] panel.rs:780: a panel or secondary side bar tab of a moved Extensions or Testing container draws no badge (the extensions count, the test results) | 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), the Extensions and Testing containers move to the panel and the secondary side bar and back with their views and open commands (cargo test -p app the_extensions_and_testing_containers; ui-pair contributed-panes.json "extensions-moved" and "testing-moved": both items dragged onto the panel open there as in the reference); 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 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/services/workspaces | workbench service | M12 | ported | [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 |