Visual Studio Code, rebuilt in Rust
Rust
feat(extensions): port Install Specific Version and the row's activation
rokartur26f98bf789c9
diff --git a/native/crates/app/src/menus.rs b/native/crates/app/src/menus.rsindex af4522afe56..08606d9babd 100644--- a/native/crates/app/src/menus.rs+++ b/native/crates/app/src/menus.rs@@ -539,11 +539,16 @@ const WORKBENCH_MENUS: &[Row] = &[(MenuId::ExtensionContext, None, "workbench.extensions.action.setColorTheme", "Set Color Theme", "_theme_", 0., Some("!inExtensionEditor && extensionStatus == 'installed' && extensionHasColorThemes"), None),(MenuId::ExtensionContext, None, "workbench.extensions.action.setFileIconTheme", "Set File Icon Theme", "_theme_", 0., Some("!inExtensionEditor && extensionStatus == 'installed' && extensionHasFileIconThemes"), None),(MenuId::ExtensionContext, None, "workbench.extensions.action.setProductIconTheme", "Set Product Icon Theme", "_theme_", 0., Some("!inExtensionEditor && extensionStatus == 'installed' && extensionHasProductIconThemes"), None),+ (MenuId::ExtensionContext, None, "workbench.extensions.action.switchToPreRlease", "Switch to Pre-Release Version", "0_install", 2., Some("hasGallery && galleryExtensionHasPreReleaseVersion && isPreReleaseExtensionAllowed && !installedExtensionIsOptedToPreRelease && !inExtensionEditor && extensionStatus == 'installed' && !isBuiltinExtension"), None),+ (MenuId::ExtensionContext, None, "workbench.extensions.action.switchToRelease", "Switch to Release Version", "0_install", 2., Some("hasGallery && galleryExtensionHasPreReleaseVersion && isExtensionAllowed && installedExtensionIsOptedToPreRelease && !inExtensionEditor && extensionStatus == 'installed' && !isBuiltinExtension"), None),+ (MenuId::ExtensionContext, None, "workbench.extensions.action.install.anotherVersion", "Install Specific Version...", "0_install", 3., Some("extensionStatus == 'uninstalled' && isGalleryExtension && isExtensionAllowed && !extensionDisallowInstall"), None),(MenuId::ExtensionContext, None, "workbench.extensions.action.copyExtension", "Copy", "1_copy", 0., None, None),(MenuId::ExtensionContext, None, "workbench.extensions.action.copyExtensionId", "Copy Extension ID", "1_copy", 0., None, None),(MenuId::ExtensionContext, None, "workbench.extensions.action.copyLink", "Copy Link", "1_copy", 0., Some("isGalleryExtension && galleryHasExtensionLink"), None),(MenuId::ExtensionContext, None, "workbench.extensions.action.configure", "Settings", "2_configure", 1., Some("extensionStatus == 'installed' && extensionHasConfiguration"), None),(MenuId::ExtensionContext, None, "workbench.extensions.action.configureKeybindings", "Keyboard Shortcuts", "2_configure", 2., Some("extensionStatus == 'installed' && extensionHasKeybindings"), None),+ (MenuId::ExtensionContext, None, "workbench.extensions.action.ignoreRecommendation", "Ignore Recommendation", "3_recommendations", 1., Some("isExtensionRecommended"), None),+ (MenuId::ExtensionContext, None, "workbench.extensions.action.undoIgnoredRecommendation", "Undo Ignored Recommendation", "3_recommendations", 1., Some("isUserIgnoredRecommendation"), None),(MenuId::ViewContainerTitle, None, "workbench.action.debug.selectandstart", "Start Additional Session", "", 10., Some("viewContainer == 'workbench.view.debug' && debugState != 'inactive' && (config.debug.toolBarLocation == 'docked' || config.debug.hideLauncherWhileDebugging)"), None),// debug.contribution.ts `registerDebugViewMenuItem(MenuId.DebugVariablesContext/DebugHoverContext/DebugWatchContext, ...)`.// shortcut: the `inline` View Binary Data items wait for the rows' action bars (ledger debug row).diff --git a/native/crates/app/src/workbench/extension_management.rs b/native/crates/app/src/workbench/extension_management.rsindex c1cd70c8e06..a139db6159a 100644--- a/native/crates/app/src/workbench/extension_management.rs+++ b/native/crates/app/src/workbench/extension_management.rs@@ -278,6 +278,62 @@ impl Workbench {Outcome::Pending(receiver)}+ /// `InstallAnotherVersionAction.run`: the compatible versions in a pick, then the picked one installs; the+ /// installed version picked again does nothing.+ pub(super) fn install_another_version(&mut self, extension: &crate::extensions_model::Extension, window: &mut Window, cx: &mut Context<Self>) {+ let identifier = extension.identifier();+ let pre_release = match &extension.local {+ Some(_) => extension.pre_release(),+ None => extension.gallery.as_ref().is_some_and(|gallery| gallery.is_pre_release_version),+ };+ let current = extension.local.as_ref().and_then(|local| local.description["version"].as_str()).map(str::to_owned);+ let gallery = self.gallery();+ let lookup = cx.background_executor().spawn(async move {+ let versions = gallery.get_all_compatible_versions(&identifier.id, identifier.uuid.as_deref(), pre_release);+ (identifier.id, versions)+ });+ cx.spawn_in(window, async move |workbench, cx| {+ let (id, versions) = lookup.await;+ let versions = match versions {+ Ok(versions) => versions,+ Err(error) => return workbench.update(cx, |workbench, cx| {+ workbench.notify_error(format!("{error:#}"));+ cx.notify();+ }),+ };+ if versions.is_empty() {+ return cx.update(|window, cx| drop(crate::dialog::show_message_box(window, crate::dialog::InTests::Refuse, PromptLevel::Info, "This extension has no other versions.", None, &["OK"], None, cx)));+ }+ let now = chrono::Utc::now().timestamp_millis();+ let mut items = Vec::new();+ for (handle, version) in versions.iter().enumerate() {+ let date = chrono::DateTime::parse_from_rfc3339(&version.date).map_or(now, |date| date.timestamp_millis());+ let mut description = crate::timeline::from_now_ago(date, now);+ if version.is_pre_release_version {+ description.push_str(" (pre-release)");+ }+ if current.as_deref() == Some(version.version.as_str()) {+ description.push_str(" (current)");+ }+ let item = crate::quick_input::Item { handle: handle as i64, id: Some(version.version.clone()), label: version.version.clone(), description: Some(description), pickable: true, ..Default::default() };+ items.push(crate::quick_input::Entry::Item(item));+ }+ let mut input = crate::quick_input::QuickInput::new(0, crate::quick_input::Kind::QuickPick);+ input.placeholder = Some("Select Version to Install".into());+ input.match_on_detail = true;+ input.set_items(items);+ let picked = workbench.update_in(cx, |workbench, window, cx| workbench.choose(input, window, cx))?;+ let Some(picked) = picked.await.ok().and_then(Result::ok).and_then(|picked| picked.as_i64()) else { return Ok(()) };+ let version = &versions[picked as usize];+ if current.as_deref() == Some(version.version.as_str()) {+ return Ok(());+ }+ let (number, pre_release) = (version.version.clone(), version.is_pre_release_version);+ workbench.update(cx, |workbench, cx| drop(workbench.install_from_gallery(id, Some(number), pre_release, cx)))+ })+ .detach();+ }+/// The gallery the installs query: Open VSX unless a test points `gallery_url` elsewhere.pub(super) fn gallery(&self) -> Gallery {Gallery { service_url: self.gallery_url.clone(), product_version: crate::VERSION.clone() }diff --git a/native/crates/app/src/workbench/extension_management/tests.rs b/native/crates/app/src/workbench/extension_management/tests.rsindex 5225ee1a049..844c55b9bfd 100644--- a/native/crates/app/src/workbench/extension_management/tests.rs+++ b/native/crates/app/src/workbench/extension_management/tests.rs@@ -112,6 +112,44 @@ fn a_gallery_install_brings_its_dependencies_and_pack_first(cx: &mut TestAppContassert_eq!(sent_jobs(&fixture.messages), ["a.dep", "a.leaf", "a.member", "a.root"]);}+/// extensionsActions.ts `InstallAnotherVersionAction`: a pre-release install picks from every compatible version, the+/// installed one marked current, and the picked version installs.+#[gpui::test]+fn install_specific_version_installs_the_picked_version(cx: &mut TestAppContext) {+ let (fixture, workbench, cx) = workbench_on_gallery("another-version", &[("a.yaml", &[], &[])], cx);+ let description = json!({ "name": "yaml", "publisher": "a", "version": "2.1.2026112008", "preRelease": true, "uuid": "uuid-a.yaml" });+ let installed = exthost::scan::ScannedExtension { id: "a.yaml".into(), location: fixture.dir.clone(), description };+ workbench.update(cx, |workbench, _| {+ workbench.load_keybindings(crate::keybindings::default_keybindings(&[]), "/nonexistent/User/keybindings.json".into());+ workbench.extensions = vec![installed.clone()];+ workbench.extensions_viewlet.installed = vec![installed];+ });+ let enabled = workbench.update_in(cx, |workbench, window, _| {+ let extension = workbench.find_extension("a.yaml").unwrap();+ let actions = workbench.manage_extension_actions(&extension, false, window);+ actions.into_iter().find_map(|action| match action {+ crate::menus::MenuAction::Command { id, enabled, .. } if id == "workbench.extensions.action.install.anotherVersion" => Some(enabled),+ _ => None,+ })+ });+ assert_eq!(enabled, Some(true));+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.extensions.action.install.anotherVersion", vec![json!("a.yaml")], window, cx)));+ cx.run_until_parked();+ let picks = workbench.read_with(cx, |workbench, _| {+ let input = workbench.quick_inputs.current().expect("the version pick");+ let rows = input.order.iter().map(|row| (input.rows[*row].item.label.clone(), input.rows[*row].item.description.clone().unwrap_or_default()));+ (input.placeholder.clone().unwrap_or_default(), rows.collect::<Vec<_>>())+ });+ assert_eq!(picks.0, "Select Version to Install");+ let labels: Vec<&str> = picks.1.iter().map(|(label, _)| label.as_str()).collect();+ assert_eq!(labels, ["2.1.2026112008", "2.0.0"]);+ assert!(picks.1[0].1.ends_with(" (pre-release) (current)"), "{}", picks.1[0].1);+ assert!(!picks.1[1].1.contains('('), "{}", picks.1[1].1);+ cx.simulate_keystrokes("down enter");+ cx.run_until_parked();+ assert_eq!(sent_jobs(&fixture.messages), ["a.yaml"]);+}+/// The deltas sent to the host: the ids started and the ids stopped.fn sent_deltas(messages: &Receiver<HostMessage>) -> Vec<(Vec<String>, Vec<String>)> {let mut deltas = Vec::new();diff --git a/native/crates/app/src/workbench/extensions_list_view.rs b/native/crates/app/src/workbench/extensions_list_view.rsindex 23c3f0ebe02..bcde8b1034c 100644--- a/native/crates/app/src/workbench/extensions_list_view.rs+++ b/native/crates/app/src/workbench/extensions_list_view.rs@@ -254,11 +254,13 @@ impl Workbench {if extension.state == ExtensionState::Uninstalled {header = header.children(self.install_count_small(&extension)).children(self.rating_small(&extension));}+ header = header.children(self.activation_time(&extension));let description = match extension.gallery.as_ref().filter(|gallery| !gallery.localized_languages.is_empty()) {Some(gallery) => gallery.localized_languages.iter().map(|name| capitalize(name)).collect::<Vec<_>>().join(", "),None => extension.description().to_owned(),};- let description = div().pr(px(8.)).overflow_hidden().whitespace_nowrap().text_ellipsis().when_some(description_color, |text, color| text.text_color(color)).child(description);+ // extension.css: the description's `line-height: normal` is 15px at 13px, and the footer's 24px height leaves out its 2px padding (content-box).+ let description = div().pr(px(8.)).line_height(px(15.)).overflow_hidden().whitespace_nowrap().text_ellipsis().when_some(description_color, |text, color| text.text_color(color)).child(description);let publisher = div().flex_1().min_w_0()@@ -269,7 +271,7 @@ impl Workbench {.font_weight(FontWeight::SEMIBOLD).when(!is_selected, |text| text.text_color(if disabled { self.color("disabledForeground") } else { self.color("descriptionForeground") })).child(extension.publisher_display_name().to_owned());- let footer = div().h(px(24.)).pt(px(2.)).pr(px(2.)).flex().items_center().justify_end().overflow_hidden().child(publisher).child(self.extension_actions(&extension, false, cx));+ let footer = div().h(px(26.)).pt(px(2.)).pr(px(2.)).flex().items_center().justify_end().overflow_hidden().child(publisher).child(self.extension_actions(&extension, false, cx));let icon = self.extension_icon(&extension, 36.).mr(px(16.));let bookmark = self.pre_release_bookmark(&extension);let id = extension.identifier().id;@@ -377,6 +379,15 @@ impl Workbench {Some(div().ml_auto().mr(px(6.)).flex().items_center().text_size(px(11.)).child(self.icon("cloud-download", 16., 16., foreground).mr(px(2.))).child(label))}+ /// `ExtensionRuntimeStatusWidget`: the history codicon and the activation time of an activated extension.+ fn activation_time(&self, extension: &Extension) -> Option<Div> {+ let activation = crate::perf::activation(&extension.identifier().id)?;+ let foreground = self.foreground_or("sideBar.foreground");+ let time = format!("{}ms", activation.code_loading + activation.activate_call);+ let selector = format!("activation-time {} {time}", extension.identifier().id);+ Some(div().debug_selector(move || selector).ml(px(2.)).flex().items_center().text_size(px(11.)).child(self.icon("history", 16., 16., foreground)).child(time))+ }+/// `RatingsWidget` small: one star and the rating rounded to halves, when someone rated it.fn rating_small(&self, extension: &Extension) -> Option<Div> {let rating = extension.rating()?;@@ -559,7 +570,24 @@ impl Workbench {context.insert("extensionHasProductIconThemes".into(), json!(has_themes(ThemeType::ProductIcon)));context.insert("extension".into(), json!(id));context.insert("isBuiltinExtension".into(), json!(extension.is_builtin()));- context.insert("isGalleryExtension".into(), json!(extension.gallery.is_some()));+ // `CONTEXT_HAS_GALLERY`: the port always has the Open VSX gallery.+ context.insert("hasGallery".into(), json!(true));+ context.insert("isGalleryExtension".into(), json!(extension.identifier().uuid.is_some()));+ // The port has no `extensions.allowed` policy nor a malicious or deprecated list, so every extension is allowed.+ context.insert("isExtensionAllowed".into(), json!(true));+ context.insert("isPreReleaseExtensionAllowed".into(), json!(true));+ context.insert("extensionDisallowInstall".into(), json!(false));+ context.insert("isWorkspaceScopedExtension".into(), json!(false));+ // Workspace recommendations are the only recommendations the port has (`getAllRecommendationsWithReason`).+ let lower = id.to_lowercase();+ let workspace_recommended = self.workspace_recommendations().contains(&lower);+ context.insert("isExtensionRecommended".into(), json!(workspace_recommended));+ context.insert("isExtensionWorkspaceRecommended".into(), json!(workspace_recommended));+ let ignored = crate::extension_recommendations::parse_ignored(self.profile_storage.lock().unwrap().get(crate::extension_recommendations::IGNORED_RECOMMENDATIONS_KEY));+ context.insert("isUserIgnoredRecommendation".into(), json!(ignored.contains(&lower)));+ context.insert("installedExtensionIsOptedToPreRelease".into(), json!(extension.local.is_some() && extension.pre_release()));+ context.insert("galleryExtensionIsPreReleaseVersion".into(), json!(extension.gallery.as_ref().is_some_and(|gallery| gallery.is_pre_release_version)));+ context.insert("galleryExtensionHasPreReleaseVersion".into(), json!(extension.gallery.as_ref().is_some_and(|gallery| gallery.has_pre_release_version)));// extensions.contribution.ts sets it from product.json `extensionsGallery.itemUrl`; every gallery entry of the port has its `detail_link`.context.insert("galleryHasExtensionLink".into(), json!(extension.gallery.is_some()));context.insert("extensionHasConfiguration".into(), json!(contributes("configuration")));@@ -570,7 +598,7 @@ impl Workbench {context}- fn manage_extension_actions(&self, extension: &Extension, in_editor: bool, window: &Window) -> Vec<MenuAction> {+ pub(super) fn manage_extension_actions(&self, extension: &Extension, in_editor: bool, window: &Window) -> Vec<MenuAction> {let command = |id: &str, title: &str| MenuAction::Command { id: id.into(), title: title.into(), enabled: true, checked: false, alt: None };let context = self.extension_context(extension, in_editor, window);let menu = |keep: &dyn Fn(&str) -> bool| crate::menus::menu_group_actions(&self.menus, MenuId::ExtensionContext, &context, keep);@@ -600,8 +628,8 @@ impl Workbench {let checked = self.is_auto_update_enabled_for(extension);update.push(MenuAction::Command { id: "workbench.extensions.action.toggleAutoUpdateForExtension".into(), title: "Auto Update".into(), enabled: true, checked, alt: None });}- // shortcut: Install Specific Version... stays disabled until the gallery's `getAllCompatibleVersions` and its version pick are ported.- install.push(action("workbench.extensions.action.install.anotherVersion", "Install Specific Version...", false));+ let another_version = !extension.is_builtin() && identifier.uuid.is_some();+ install.push(action("workbench.extensions.action.install.anotherVersion", "Install Specific Version...", another_version));install.push(action("extensions.uninstall", "Uninstall", !extension.is_builtin()));} else if extension.state == ExtensionState::Uninstalled && gallery {install.insert(0, command("extensions.install", "Install"));diff --git a/native/crates/app/src/workbench/extensions_list_view/tests.rs b/native/crates/app/src/workbench/extensions_list_view/tests.rsindex d6ffe327755..937fbe51485 100644--- a/native/crates/app/src/workbench/extensions_list_view/tests.rs+++ b/native/crates/app/src/workbench/extensions_list_view/tests.rs@@ -115,3 +115,63 @@ fn the_manage_menu_sets_a_theme_of_the_extension(cx: &mut TestAppContext) {workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.extensions.action.setFileIconTheme", vec![json!("vscode.vscode-theme-seti")], window, cx)));assert_eq!(picks(cx), ("Select File Icon Theme".to_string(), vec!["Seti (Visual Studio Code)".to_string()]));}++/// extensions.contribution.ts: an uninstalled gallery extension offers Install Specific Version..., and the Ignore+/// Recommendation pair toggles the profile's globally ignored recommendations.+#[gpui::test]+fn the_manage_menu_installs_a_version_and_toggles_an_ignored_recommendation(cx: &mut TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();+ let theme = load_theme(&[themes], "Dark Modern").unwrap();+ let (workbench, cx) = cx.add_window_view(|_, cx| Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx));+ let gallery = exthost::gallery::GalleryExtension { id: "pub.ext".into(), uuid: "uuid-pub.ext".into(), ..Default::default() };+ let extension = Extension { local: None, gallery: Some(gallery), state: ExtensionState::Uninstalled, enablement: EnablementState::EnabledGlobally, running: false, restart_required: false };+ let titles = |cx: &mut gpui::VisualTestContext| {+ let actions = workbench.update_in(cx, |workbench, window, _| workbench.manage_extension_actions(&extension, false, window));+ actions.into_iter().filter_map(|action| match action {+ MenuAction::Command { title, .. } => Some(title),+ _ => None,+ }).collect::<Vec<_>>()+ };+ assert_eq!(titles(cx), ["Install", "Install Specific Version...", "Copy", "Copy Extension ID", "Copy Link"]);+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.extensions.action.ignoreRecommendation", vec![json!("Pub.Ext")], window, cx)));+ let stored = workbench.read_with(cx, |workbench, _| workbench.profile_storage.lock().unwrap().get(crate::extension_recommendations::IGNORED_RECOMMENDATIONS_KEY).map(str::to_owned));+ assert_eq!(stored.as_deref(), Some(r#"["pub.ext"]"#));+ assert_eq!(titles(cx).last().map(String::as_str), Some("Undo Ignored Recommendation"));+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.extensions.action.undoIgnoredRecommendation", vec![json!("pub.ext")], window, cx)));+ assert_eq!(titles(cx).last().map(String::as_str), Some("Copy Link"));++ let gallery = exthost::gallery::GalleryExtension { id: "pub.ext".into(), uuid: "uuid-pub.ext".into(), has_pre_release_version: true, ..Default::default() };+ let switch = |pre_release: bool, cx: &mut gpui::VisualTestContext| {+ let local = ScannedExtension { id: "pub.ext".into(), location: app_root.clone(), description: json!({ "preRelease": pre_release }) };+ let installed = Extension { local: Some(local), gallery: Some(gallery.clone()), state: ExtensionState::Installed, ..extension.clone() };+ let actions = workbench.update_in(cx, |workbench, window, _| workbench.manage_extension_actions(&installed, false, window));+ actions.into_iter().filter_map(|action| match action {+ MenuAction::Command { title, .. } if title.starts_with("Switch") => Some(title),+ _ => None,+ }).collect::<Vec<_>>()+ };+ assert_eq!(switch(false, cx), ["Switch to Pre-Release Version"]);+ assert_eq!(switch(true, cx), ["Switch to Release Version"]);+}++/// extensionsWidgets.ts `ExtensionRuntimeStatusWidget`: an activated extension's row shows its code loading plus+/// activate call time.+#[gpui::test]+fn an_activated_extensions_row_shows_its_activation_time(cx: &mut TestAppContext) {+ let app_root = Path::new(env!("VSCODE_SRC")).to_path_buf();+ let themes = scan_extension(&app_root.join("extensions/theme-defaults"), true).unwrap();+ let theme = load_theme(&[themes], "Dark Modern").unwrap();+ let (workbench, cx) = cx.add_window_view(|_, cx| {+ let mut workbench = Workbench::new(theme, app_root.clone(), None, Languages::new(&[]), crate::default_settings(), HostSync::new(std::sync::mpsc::channel().0), cx);+ workbench.set_part_hidden(crate::workbench::layout::Part::SideBar, false, cx);+ workbench+ });+ cx.simulate_resize(gpui::size(gpui::px(1024.), gpui::px(768.)));+ let local = ScannedExtension { id: "test.timed".into(), location: app_root.clone(), description: json!({ "name": "timed", "displayName": "Timed" }) };+ workbench.update(cx, |workbench, _| workbench.extensions_viewlet.installed = vec![local]);+ crate::perf::extension_activated(&[json!({ "value": "test.timed" }), json!(30), json!(3), json!(5), json!({ "startup": false, "activationEvent": "*" })]);+ workbench.update_in(cx, |workbench, window, cx| drop(workbench.execute_command("workbench.extensions.search", vec![json!("@installed")], window, cx)));+ cx.run_until_parked();+ assert!(cx.debug_bounds("activation-time test.timed 33ms").is_some());+}diff --git a/native/crates/app/src/workbench/extensions_view.rs b/native/crates/app/src/workbench/extensions_view.rsindex 8c3f5be07d9..5f2f0d34efc 100644--- a/native/crates/app/src/workbench/extensions_view.rs+++ b/native/crates/app/src/workbench/extensions_view.rs@@ -558,6 +558,28 @@ impl Workbench {None => Outcome::error(format!("Extension '{id}' not found.")),}});+ self.commands.register("workbench.extensions.action.install.anotherVersion", |workbench, args, window, cx| {+ if let Some(extension) = args.first().and_then(Value::as_str).and_then(|id| workbench.find_extension(id)) {+ workbench.install_another_version(&extension, window, cx);+ }+ Outcome::done()+ });+ // `TogglePreReleaseExtensionAction.run`: opens the extension and installs it with the other kind.+ for (command, pre_release) in [("workbench.extensions.action.switchToPreRlease", true), ("workbench.extensions.action.switchToRelease", false)] {+ self.commands.register(command, move |workbench, args, window, cx| {+ let Some(extension) = args.first().and_then(Value::as_str).and_then(|id| workbench.find_extension(id)) else { return Outcome::done() };+ let id = extension.identifier().id;+ workbench.open_extension_editor(extension, true, window, cx);+ workbench.install_from_gallery(id, None, pre_release, cx)+ });+ }+ for (command, ignore) in [("workbench.extensions.action.ignoreRecommendation", true), ("workbench.extensions.action.undoIgnoredRecommendation", false)] {+ self.commands.register(command, move |workbench, args, window, cx| {+ let id = args.first().and_then(Value::as_str).unwrap_or_default();+ workbench.toggle_global_ignored_recommendation(id, ignore, window, cx);+ Outcome::done()+ });+ }self.commands.register("workbench.extensions.action.copyExtension", |workbench, args, _, cx| {let Some(extension) = args.first().and_then(Value::as_str).and_then(|id| workbench.find_extension(id)) else { return Outcome::done() };cx.write_to_clipboard(gpui::ClipboardItem::new_string(copy_text(&extension)));@@ -902,6 +924,29 @@ impl Workbench {recommendations::allowed_recommendations(&recommendations::workspace_recommendations(&configs), &ignored)}+ /// extensionIgnoredRecommendationsService.ts `toggleGlobalIgnoredRecommendation`, then the recommendation views+ /// load again (`onDidChangeRecommendations`).+ fn toggle_global_ignored_recommendation(&mut self, id: &str, ignore: bool, window: &mut Window, cx: &mut Context<Self>) {+ let id = id.to_lowercase();+ let mut storage = self.profile_storage.lock().unwrap();+ let mut ignored = recommendations::parse_ignored(storage.get(recommendations::IGNORED_RECOMMENDATIONS_KEY));+ if ignored.contains(&id) == ignore {+ return;+ }+ match ignore {+ true => ignored.push(id),+ false => ignored.retain(|ignored| *ignored != id),+ }+ storage.set(recommendations::IGNORED_RECOMMENDATIONS_KEY, json!(ignored).to_string());+ drop(storage);+ for index in 0..self.extensions_viewlet.panes.len() {+ if model::is_recommendations_query(&Query::parse(&self.extensions_viewlet.panes[index].query).value) {+ self.load_recommendations_pane(index, window, cx);+ }+ }+ cx.notify();+ }+/// `getExtensionsConfigs`: the workspace file's first, then each folder's.fn extensions_configs(&self) -> Vec<recommendations::ExtensionsConfig> {let settings = self.settings.lock().unwrap();diff --git a/port/ledger.md b/port/ledger.mdindex 610dd64e387..cacc5186ef9 100644--- a/port/ledger.md+++ b/port/ledger.md@@ -536,7 +536,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston| workbench/contrib/emergencyAlert | workbench contribution | | removed | | no AI or Microsoft services by decision (port/notes.md); API stays inert || workbench/contrib/emmet | workbench contribution | M13 | verified | | workbench/emmet.rs: Emmet: Expand Abbreviation (`emmet.expandAbbreviation` with the language at the cursor and the emmet parent mode of its grammar's scope, emmetAction.test.ts cases), Tab with `emmet.triggerExpansionOnTab`, the Edit menu entry: cargo test -p app emmet menubar || workbench/contrib/encryption | workbench contribution | M10 | n/a | | encryption.contribution.ts only migrates Linux `password-store` argv values to gnome-libsecret; the port runs on macOS and keeps secrets in the Keychain |-| workbench/contrib/extensions | workbench contribution | M18 | ported | [3 M] extensions_list_view.rs `manage_extension_actions`: Install Specific Version... (extensionsActions.ts `InstallAnotherVersionAction`) stays disabled, the gallery's `getAllCompatibleVersions` and the version pick are not ported <br> [3 S] extensions_list_view.rs `extension_row`: no activation time (`ActivationTimeWidget`, the reference shows `33ms` on `@builtin emmet` in ui-pair `menus/extension-context.json`), and the name sits about 4px higher and the description and publisher 2px to 5px lower than the reference's <br> [3 M] extensions.contribution.ts: of the `MenuId.ExtensionContext` items the port has Set Color/File Icon/Product Icon Theme, Copy, Copy Extension ID, Copy Link, Settings and Keyboard Shortcuts; the pre-release, install, download, account, profile, sync and recommendation items wait for their commands, and the keys they read (`isExtensionRecommended`, `isExtensionAllowed`, ...) are not set | cargo test -p app extension the_manage_menu_lists_the_extension_context_menu the_manage_menu_sets_a_theme_of_the_extension the_views_are_panes extension_bisect bisect_finds_the_extension_and_keeps_it_disabled extension_features the_runtime_status_lists_uncaught_errors_and_messages invalid_contributed static_entries_need_the_proposal group_needs_the_proposal debuggers_merge_by_type_and_keep_the_built_in_values skipped_menu_contributions_are_extension_messages contributed_command_messages invalid_views_and_view_containers_are_extension_messages invalid_configuration_is_an_extension_message invalid_json_validation_is_an_extension_message invalid_colors_and_icons_are_extension_messages invalid_semantic_token_contributions_are_extension_messages invalid_problem_patterns_and_matchers_are_extension_messages invalid_grammars_are_extension_messages invalid_notebook_contributions_are_extension_messages (extensionsViews, extensionQuery, extensionEnablementService tests); ui-pair `menus/extension-context.json` with `--extensionDevelopmentPath=<repo>/port/fixtures/extensions/menus`, `menus/extension-theme.json`, port/fixtures/extensions/ui-view.json. Out with removed parts: Report Issue & Continue (contrib/issue), the authentication point (services/authentication) |+| workbench/contrib/extensions | workbench contribution | M18 | ported | [3 M] extensions.contribution.ts: the `MenuId.ExtensionContext` items Auto Update (Publisher), Install (unsigned), Install (Do not Sync), Install Pre-Release (Do not Sync), Download VSIX, Download Pre-Release VSIX, Download Specific Version VSIX..., Account Preferences, Apply Extension to all Profiles, Sync This Extension and Add to/Remove from Workspace Recommendations wait for their commands (Show Pre-Release/Release Version belong to the extension editor's menu) | cargo test -p app extension the_manage_menu_lists_the_extension_context_menu the_manage_menu_installs_a_version_and_toggles_an_ignored_recommendation install_specific_version_installs_the_picked_version an_activated_extensions_row_shows_its_activation_time the_manage_menu_sets_a_theme_of_the_extension the_views_are_panes extension_bisect bisect_finds_the_extension_and_keeps_it_disabled extension_features the_runtime_status_lists_uncaught_errors_and_messages invalid_contributed static_entries_need_the_proposal group_needs_the_proposal debuggers_merge_by_type_and_keep_the_built_in_values skipped_menu_contributions_are_extension_messages contributed_command_messages invalid_views_and_view_containers_are_extension_messages invalid_configuration_is_an_extension_message invalid_json_validation_is_an_extension_message invalid_colors_and_icons_are_extension_messages invalid_semantic_token_contributions_are_extension_messages invalid_problem_patterns_and_matchers_are_extension_messages invalid_grammars_are_extension_messages invalid_notebook_contributions_are_extension_messages (extensionsViews, extensionQuery, extensionEnablementService tests); cargo test -p exthost all_compatible_versions_follow_the_kind_and_the_engine; ui-pair `menus/extension-context.json` with `--extensionDevelopmentPath=<repo>/port/fixtures/extensions/menus`, `menus/extension-theme.json`, port/fixtures/extensions/ui-view.json. Out with removed parts: Report Issue & Continue (contrib/issue), the authentication point (services/authentication) || workbench/contrib/externalTerminal | workbench contribution | M15 | verified | | workbench/external_terminal.rs: Open New External Terminal (`workbench.action.terminal.openNativeConsole`, cmd+shift+c), with several workspace folders after the Select workspace folder pick (cargo test -p app open_native_console_picks_a_folder_in_a_multi_root_workspace); cargo test -p app external_terminal; ui-pair (port/results/terminal.md) || workbench/contrib/externalUriOpener | workbench contribution | M12 | verified | | workbench/opener.rs: externalUriOpenerService.ts getRequestedOpener (workbench.externalUriOpeners globs), chooseOpener, "How would you like to open: {0}" picker; no Simple Browser (out of scope); verified at port-m12b-verify: cargo test -p app opener 4/4; Simple Browser is out of scope by decision || workbench/contrib/files | workbench contribution | M12 | verified | | explorer.rs, dialog.rs, workbench/workspace_editing.rs, workbench/file_compare.rs: cargo test -p app explorer_actions file_actions view_state nest copy_path copied_path_labels compact get_context compressed_navigation explorer_find find_filters files_dropped_from_finder view_title_and_file_actions new_file_creates file_compare focus_view_commands files_that_do_not_resolve open_editors body_limits_clamp sticky pinned_editors tab_scroll tree_guides hover unpin_hover open_with_opens_the_resource the_context_menu_selects_the_row readonly_keys_follow_the_focused_item_and_its_parent a_failed_create_offers a_folder_dropped_on_the_root a_delete_confirmation_follows_the_dialog_style cmd_v_pastes_the_files_finder_copied dragging_a_root_reorders_the_workspace_folders compacts_single_child_folders_into_one_row a_workspace_root_that_fails_to_resolve_is_decorated_with_its_error a_copy_onto_a_dirty_model_reverts_it_to_the_copied_file an_unreadable_folder_expands_to_no_children (explorerFileNestingTrie.test.ts); ui-pair port/fixtures/ui-pair/m12/workspace-folders.json, port/fixtures/ui-pair/m12/compare-saved.json, m12/compare.json, m12/find-in-folder.json, m12/folder-terminal.json, m12/explorer-ops.json, m12/editor-placeholders.json, m12/open-editors.json, m12/tab-scroll.json, m12/explorer-guides.json, m12/pinned-tabs.json (port/results/contextmenu.md). Differences left (port/notes.md milestone 12): a long tooltip breaks one segment earlier (GPUI line wrapper), the pin action loses its hover after Cmd+W until the pointer moves, a shrink sticky tab with a badge has no room for its name. Virtual workspaces: milestone 25 |