Visual Studio Code, rebuilt in Rust
Rust
feat(menus): map the terminal/context and terminal/title/context menu keys
rokarturdd3640a082d0
diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rsindex 488636c02ac..7e5bf03cd86 100644--- a/native/crates/app/src/menus.rs+++ b/native/crates/app/src/menus.rs@@ -874,7 +874,7 @@ pub fn workbench_menus() -> Vec<MenuItem> {/// menusExtensionPoint.ts `apiMenus`: the `contributes.menus` keys of the menus the port shows. `commandPalette`/// is read by `command_palette::menu`.-const API_MENUS: [(&str, MenuId); 42] = [+const API_MENUS: [(&str, MenuId); 44] = [("file/newFile", MenuId::NewFile),("editor/context", MenuId::EditorContext),("explorer/context", MenuId::ExplorerContext),@@ -917,6 +917,8 @@ const API_MENUS: [(&str, MenuId); 42] = [("comments/comment/title", MenuId::CommentTitle),("comments/comment/context", MenuId::CommentActions),("commentsView/commentThread/context", MenuId::CommentsViewThreadActions),+ ("terminal/context", MenuId::TerminalInstanceContext),+ ("terminal/title/context", MenuId::TerminalTabContext),];/// The `icon` of each `contributes.commands` entry with one: a `$(codicon)` name, or the light and dark image paths.diff --git a/native/crates/app/src/menus/tests.rs b/native/crates/app/src/menus/tests.rsindex 070f5fc33be..e50b4fddb35 100644--- a/native/crates/app/src/menus/tests.rs+++ b/native/crates/app/src/menus/tests.rs@@ -178,6 +178,17 @@ fn extension_menu_items() {assert_eq!(ids(&menu_actions(&items, MenuId::ExplorerContext, &no_context())), ["a.alt"]);}+/// menusExtensionPoint.ts `apiMenus`: the keys of the menus a view of the port shows.+#[test]+fn api_menu_keys_reach_their_menus() {+ let keys = [("terminal/context", MenuId::TerminalInstanceContext), ("terminal/title/context", MenuId::TerminalTabContext)];+ for (key, menu) in keys {+ let items = extension_menus(&[extension("k", json!({ "commands": [{ "command": "k.run", "title": "Run" }], "menus": { key: [{ "command": "k.run" }] } }))]);+ let reached: Vec<_> = items.iter().map(|item| item.menu).collect();+ assert_eq!(reached, [menu], "{key}");+ }+}+/// `isValidItems`: one invalid item drops the whole menu of that extension.#[test]fn an_invalid_item_drops_its_menu() {diff --git a/port/ledger.md b/port/ledger.mdindex f3518304f2a..23b5d9b3300 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -365,7 +365,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/parts/views | workbench part | M11 | verified | | Explorer views as panes (view_panes.rs): collapse by mouse and keys, sashes, header drag to reorder with drop overlay, state in workbench.explorer.views.state; no view actions, view menus or hidden views; cargo test -p app view_panes, ui-pair port/results/layout.md; pane headers drawn statically (workbench.rs section_header): no collapse, resize or view actions; verified: ui-pair port/results/references-view.md and every pair of port/results/windows.md (milestone 11 verification): the Explorer panes and contributed views as the reference; Explorer and Source Control views as panes of a ViewPaneContainer (view_panes.rs `PaneContainer`): collapse by mouse and keys, sashes, header drag to reorder with drop overlay, single view merged into the container, header actions, state in the container's storageId; cargo test -p app view_panes scm_container, ui-pair port/results/layout.md and port/fixtures/ui-pair/m11/scm-panes.json (port/notes.md View panes); verified: ui-pair port/results/references-view.md and every pair of port/results/windows.md (milestone 11 verification): the Explorer panes and contributed views as the reference; Run and Debug, Extensions and webview containers still draw section_header rows: no collapse, resize or view actions; welcome buttons draw their `$(icon)`s (cargo test -p app a_welcome_button_draws_its_label_icons; ui-pair port/fixtures/ui-pair/icons/scm-welcome.json: github's Publish to GitHub button with the github codicon as the reference); wrapped text stacks unsnapped 18.2px lines as Chromium (vendor gpui elements/text.rs; cargo test -p app wrapped_lines_keep_their_fractional_line_height): scm-welcome's Publish button 0.5pt from the reference, was 2.5pt; left: the port wraps "Git" of "To learn more about how to use Git" to the next line; a merged view's "..." puts the Views submenu, a separator and the view's own actions (panecomposite.ts `getSecondaryActions`; cargo test -p app a_merged_changes_view_shows_the_views_submenu_in_its_more_actions a_merged_view_without_actions_lists_the_view_toggles_flat) || workbench/services/accessibility | workbench service | M19 | verified | | electron-browser accessibilityService.ts over GPUI: screen reader attach follows Electron's `isAccessibilitySupportEnabled` on macOS (VoiceOver, or an assistive app setting AXManualAccessibility or AXEnhancedUserInterface, as cua-driver does; ui-pair screen-reader-detection.json with accessibility support auto shows the prompt in both), the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib; electron-browser accessibilityService.ts over GPUI: screen reader attach follows is_a11y_active, the Screen reader usage detected prompt and status entry; port/tools/a11y-check; cargo test -p app accessib || workbench/services/accounts | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported |-| workbench/services/actions | workbench service | M9 | ported | [3 L] contributes.menus: about 34 unmapped ids: debug/*, terminal/*, testing/*, viewContainer/title, webview/context, extension/context, editor/title/run, modalEditor/editorTitle, notebook/cell/execute, notebook/kernelSource, mergeEditor/result/title, comments peek, issue/reporter; chat/*, agents/*, ports/*, statusBar/remoteIndicator class 4; touchBar class 2 | contributes.menus and contributes.submenus for editor/context, explorer/context, editor/title/context (menus::extension_menus): cargo test -p app menus explorer_actions; ui-pair README.md Explorer menu (port/results/contextmenu.md); other menu ids wait for their views |+| workbench/services/actions | workbench service | M9 | ported | [3 L] contributes.menus: about 32 unmapped ids: debug/*, testing/*, viewContainer/title, webview/context, extension/context, editor/title/run, modalEditor/editorTitle, notebook/cell/execute, notebook/kernelSource, mergeEditor/result/title, comments peek, issue/reporter; chat/*, agents/*, ports/*, statusBar/remoteIndicator class 4; touchBar class 2 | contributes.menus and contributes.submenus for editor/context, explorer/context, editor/title/context (menus::extension_menus): cargo test -p app menus explorer_actions; terminal/context and terminal/title/context (cargo test -p app api_menu_keys_reach_their_menus); ui-pair README.md Explorer menu (port/results/contextmenu.md); other menu ids wait for their views || workbench/services/activity | workbench service | M11 | verified | | activity badges of view containers: view `$setBadge` values, the SCM and Extensions counts and `withProgress` progress badges (300 ms delay, kept 300 ms), numbers summed and shortened as compositeBarActions.ts (workbench/activity.rs; cargo test -p app -- activity progress_at_a_view_container_badges_its_activity_bar_item); `withCompositeProgress` progress bars of a container (side bar or panel title bottom) and of a view (pane header, merged title): `options.delay`, discrete worked of total, infinite, gone on done (progress_at_a_view_container_shows_its_progress_bar_under_the_title); ui-pair `activity-badge.json` on a git folder with two changes: the Source Control badge matches the reference (AE 1808 over the window, port/results/layout.md) || workbench/services/agentEditorComments | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported || workbench/services/agentHost | workbench service | | removed | | no sign-in/AI by decision (port/notes.md); not ported |