Skip to content

Visual Studio Code, rebuilt in Rust

Rust

feat(extensions): start and stop extensions another source installs

rokartur2c71dc879719
diff --git a/README.md b/README.md
index 5332551c954..c00913933fc 100644
--- a/README.md
+++ b/README.md
@@ -11,15 +11,15 @@ Coverage of VS Code 1.147.0, from [port/ledger.md](port/ledger.md) (584 rows). V
```mermaid
pie showData
- "verified" : 415
- "ported" : 15
+ "verified" : 416
+ "ported" : 14
"removed" : 126
"n/a" : 28
```
| area | verified | ported | removed | n/a | verified of in scope |
|---|---:|---:|---:|---:|---|
-| src/vs/platform | 68 | 1 | 30 | 13 | `████████████████████ 99%` |
+| src/vs/platform | 69 | 0 | 30 | 13 | `████████████████████ 100%` |
| workbench contribution | 65 | 3 | 30 | 3 | `███████████████████░ 96%` |
| built-in extension | 88 | 1 | 6 | 0 | `████████████████████ 99%` |
| MainThread* shape (Rust side) | 58 | 1 | 30 | 0 | `████████████████████ 98%` |
@@ -31,7 +31,7 @@ pie showData
| src/vs/editor | 0 | 2 | 1 | 1 | `░░░░░░░░░░░░░░░░░░░░ 0%` |
| src/vs/base | 0 | 0 | 2 | 3 | `████████████████████ 100%` |
| port feature | 1 | 0 | 0 | 0 | `████████████████████ 100%` |
-| **all** | **415** | **15** | **126** | **28** | `███████████████████░ 97%` |
+| **all** | **416** | **14** | **126** | **28** | `███████████████████░ 97%` |
<!-- coverage:end -->
`removed` are parts left out by decision: AI features, Microsoft services, telemetry, remote and tunnels ([port/notes.md](port/notes.md)). `n/a` are upstream test infrastructure and the Electron process, IPC and DOM layers the native architecture replaces.
diff --git a/native/crates/app/src/main.rs b/native/crates/app/src/main.rs
index f0ae4eb1d63..e8fb294bfad 100644
--- a/native/crates/app/src/main.rs
+++ b/native/crates/app/src/main.rs
@@ -248,6 +248,8 @@ fn main() -> anyhow::Result<()> {
perf::mark("code/didScanExtensions");
// Artur: user extensions live in ~/.vsrustium/extensions, the default user data dir's extensions folder.
let extensions_folder = flag_value("--extensions-dir").map_or_else(|| user_data.join("extensions"), PathBuf::from);
+ // code/electron-main/main.ts `initServices` makes the extensions folder; the extensions watcher watches it.
+ std::fs::create_dir_all(&extensions_folder)?;
UserExtensions::new(extensions_folder.clone(), &VERSION).clean_up()?;
// storageMainService.ts: no storage during extension tests, so each test run starts empty.
let extension_tests = development.as_ref().is_some_and(|development| development.tests_path.is_some());
@@ -574,6 +576,7 @@ pub(crate) fn open_window(request: WindowRequest, cx: &mut App) -> anyhow::Resul
workbench.watch_window_focus(window, cx);
workbench.watch_window_close(window, cx);
workbench.set_installed_extensions(builtins.clone(), user_extensions.clone_for_profile(), developed.clone(), cx);
+ workbench.start_extensions_watcher(cx);
workbench.set_user_data_profiles(profile, cx);
workbench.install_template_extensions(window, cx);
workbench.offer_settings_import(window, cx);
diff --git a/native/crates/app/src/workbench/extension_management.rs b/native/crates/app/src/workbench/extension_management.rs
index 5918d3c53a5..c1cd70c8e06 100644
--- a/native/crates/app/src/workbench/extension_management.rs
+++ b/native/crates/app/src/workbench/extension_management.rs
@@ -2,8 +2,12 @@
//! notification after a VSIX install, and the contributions the workbench reads again once the host runs the change.
use std::path::PathBuf;
+use std::time::Duration;
use config::configuration::Overrides;
+use files::watcher::{Change, Watcher};
+use futures::StreamExt;
+use futures::channel::mpsc;
use exthost::extension_management::Job;
use exthost::gallery::{ExtensionInfo, Gallery, Operation};
use exthost::scan::ScannedExtension;
@@ -409,6 +413,91 @@ impl Workbench {
Outcome::Pending(receiver)
}
+ /// extensionsWatcher.ts: the profile's `extensions.json` changes when the CLI or another window installs or
+ /// uninstalls; this window then starts and stops those extensions.
+ pub fn start_extensions_watcher(&mut self, cx: &mut Context<Self>) {
+ let (sender, mut receiver) = mpsc::unbounded::<Vec<Change>>();
+ let watcher = match Watcher::new(move |changes| drop(sender.unbounded_send(changes))) {
+ Ok(watcher) => watcher,
+ Err(error) => return eprintln!("[extensions] Error while initializing Extensions Watcher: {error}"),
+ };
+ self.extensions_viewlet.profile_watcher = Some(watcher);
+ self.watch_profile_extensions();
+ cx.spawn(async move |workbench, cx| {
+ while let Some(changes) = receiver.next().await {
+ if workbench.update(cx, |workbench, cx| workbench.profile_extensions_changed(&changes, cx)).is_err() {
+ return;
+ }
+ }
+ })
+ .detach();
+ }
+
+ /// `onDidChangeProfiles`: the folder of the current profile's `extensions.json`; a profile switch watches the new one.
+ pub(super) fn watch_profile_extensions(&mut self) {
+ let viewlet = &mut self.extensions_viewlet;
+ let (Some(watcher), Some(user)) = (viewlet.profile_watcher.as_mut(), &viewlet.user) else { return };
+ watcher.unwatch(0);
+ let folder = user.extensions_file.parent().expect("extensions.json has a folder");
+ if let Err(error) = watcher.watch(0, folder, false, &[]) {
+ eprintln!("[extensions] {}: {error}", folder.display());
+ }
+ }
+
+ /// `onDidFilesChange`: a change of `extensions.json` reads it again 100 ms after the last one, as the CLI writes it
+ /// once per extension.
+ pub(super) fn profile_extensions_changed(&mut self, changes: &[Change], cx: &mut Context<Self>) {
+ let Some(user) = &self.extensions_viewlet.user else { return };
+ if !changes.iter().any(|change| change.path == user.extensions_file) {
+ return;
+ }
+ self.extensions_viewlet.profile_change = Some(cx.spawn(async move |workbench, cx| {
+ cx.background_executor().timer(Duration::from_millis(100)).await;
+ let _ = workbench.update(cx, |workbench, cx| drop(workbench.apply_profile_extensions(cx)));
+ }));
+ }
+
+ /// `onDidChangeExtensionsByAnotherSource`, then `_handleDeltaExtensions`: the enabled user extensions that do not run
+ /// start (replacing another copy of their id), and running user extensions no longer installed stop (a built-in with
+ /// their id starts instead). What this window installed itself already runs, so it makes no delta.
+ pub(super) fn apply_profile_extensions(&mut self, cx: &mut Context<Self>) -> Outcome {
+ // A half-written extensions.json reads as an error; its next change brings the rest.
+ if !self.rescan_installed_extensions() {
+ return Outcome::done();
+ }
+ let viewlet = &self.extensions_viewlet;
+ let user_folder = viewlet.user.as_ref().expect("a scanned profile").folder.clone();
+ let is_user = |extension: &ScannedExtension| extension.location.starts_with(&user_folder);
+ let mut to_add = Vec::new();
+ let mut to_remove = Vec::new();
+ for extension in self.local_extensions() {
+ let Some(local) = extension.local else { continue };
+ if !extension.enablement.is_enabled() || viewlet.development.iter().any(|id| id.eq_ignore_ascii_case(&local.id)) {
+ continue;
+ }
+ let running = self.extensions.iter().find(|running| running.id.eq_ignore_ascii_case(&local.id));
+ match running {
+ None if is_user(&local) => to_add.push(local),
+ Some(running) if running.location != local.location && (is_user(&local) || is_user(running)) => {
+ to_remove.push(running.id.clone());
+ to_add.push(local);
+ }
+ _ => {}
+ }
+ }
+ for running in &self.extensions {
+ let installed = viewlet.installed.iter().any(|extension| extension.id.eq_ignore_ascii_case(&running.id));
+ if is_user(running) && !installed {
+ to_remove.push(running.id.clone());
+ }
+ }
+ self.refresh_extensions_views(cx);
+ if to_add.is_empty() && to_remove.is_empty() {
+ return Outcome::done();
+ }
+ self.run_extension_jobs(vec![Job::Delta(to_add, to_remove)], None, cx, |error| error)
+ }
+
/// The extension points the workbench reads, after `_doHandleExtensionPoints` with the running extensions.
pub(super) fn set_running_extensions(&mut self, running: Vec<ScannedExtension>, cx: &mut Context<Self>) {
self.languages = crate::languages::Languages::new(&running);
diff --git a/native/crates/app/src/workbench/extension_management/tests.rs b/native/crates/app/src/workbench/extension_management/tests.rs
index 0e532b52e05..5225ee1a049 100644
--- a/native/crates/app/src/workbench/extension_management/tests.rs
+++ b/native/crates/app/src/workbench/extension_management/tests.rs
@@ -1,10 +1,12 @@
use std::path::{Path, PathBuf};
use std::sync::mpsc::Receiver;
use std::sync::{Arc, Mutex};
+use std::time::Duration;
use config::registry::Registry;
use config::service::Settings;
-use exthost::extension_management::Job;
+use exthost::extension_management::{Job, UserExtensions};
+use files::watcher::{Change, ChangeType};
use exthost::gallery::test_support::{gallery_entry, serve_gallery};
use exthost::gallery::{Gallery, extension_key};
use gpui::{TestAppContext, VisualTestContext};
@@ -109,3 +111,44 @@ fn a_gallery_install_brings_its_dependencies_and_pack_first(cx: &mut TestAppCont
cx.run_until_parked();
assert_eq!(sent_jobs(&fixture.messages), ["a.dep", "a.leaf", "a.member", "a.root"]);
}
+
+/// 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();
+ for message in messages.try_iter() {
+ if let Some((Job::Delta(to_add, to_remove), _)) = message.extensions {
+ deltas.push((to_add.into_iter().map(|extension| extension.id).collect(), to_remove));
+ }
+ }
+ deltas
+}
+
+/// extensionsWatcher.ts: an extension the CLI adds to the profile's extensions.json starts in the running window, one
+/// it removes stops, and one that already runs makes no delta.
+#[gpui::test]
+fn extensions_installed_by_another_source_start_and_stop(cx: &mut TestAppContext) {
+ let (fixture, workbench, cx) = workbench_on_gallery("extensions-watcher", &[], cx);
+ let cli = UserExtensions::new(fixture.dir.join("extensions"), &crate::VERSION);
+ workbench.update(cx, |workbench, _| workbench.extensions_viewlet.user = Some(cli.clone_for_profile()));
+ let vsix = write_vsix(&fixture.dir, &[], &[]);
+ let changed = vec![Change { path: cli.extensions_file.clone(), kind: ChangeType::Updated }];
+
+ let installed = cli.install_vsix(&vsix).unwrap();
+ workbench.update(cx, |workbench, cx| workbench.profile_extensions_changed(&changed, cx));
+ cx.executor().advance_clock(Duration::from_millis(200));
+ cx.run_until_parked();
+ assert_eq!(sent_deltas(&fixture.messages), [(vec!["a.root".to_owned()], Vec::new())]);
+
+ workbench.update(cx, |workbench, cx| {
+ workbench.extensions = vec![installed];
+ drop(workbench.apply_profile_extensions(cx));
+ });
+ cx.run_until_parked();
+ assert_eq!(sent_deltas(&fixture.messages), []);
+
+ cli.uninstall("a.root").unwrap();
+ workbench.update(cx, |workbench, cx| workbench.profile_extensions_changed(&changed, cx));
+ cx.executor().advance_clock(Duration::from_millis(200));
+ cx.run_until_parked();
+ assert_eq!(sent_deltas(&fixture.messages), [(Vec::new(), vec!["a.root".to_owned()])]);
+}
diff --git a/native/crates/app/src/workbench/extensions_view.rs b/native/crates/app/src/workbench/extensions_view.rs
index 95324ac76df..a6c5d6d3dd1 100644
--- a/native/crates/app/src/workbench/extensions_view.rs
+++ b/native/crates/app/src/workbench/extensions_view.rs
@@ -237,6 +237,9 @@ pub struct ExtensionsViewlet {
pub selected: Option<(usize, usize)>,
pub(super) search_task: Option<Task<()>>,
pub(super) update_check: Option<Task<()>>,
+ /// extensionsWatcher.ts: the folder of the profile's `extensions.json`, and the read 100 ms after its last change.
+ pub(super) profile_watcher: Option<files::watcher::Watcher>,
+ pub(super) profile_change: Option<Task<()>>,
}
impl ExtensionsViewlet {
@@ -262,6 +265,8 @@ impl ExtensionsViewlet {
selected: None,
search_task: None,
update_check: None,
+ profile_watcher: None,
+ profile_change: None,
}
}
@@ -316,16 +321,19 @@ impl Workbench {
self.schedule_workspace_recommendations_prompt(cx);
}
- pub(super) fn rescan_installed_extensions(&mut self) {
+ /// Answers whether the user extensions were read; without them only the built-ins are installed.
+ pub(super) fn rescan_installed_extensions(&mut self) -> bool {
let viewlet = &mut self.extensions_viewlet;
let mut installed = viewlet.builtins.clone();
let user = viewlet.user.as_ref().map(|user| user.scan()).transpose();
+ let scanned = user.is_ok();
match user {
Ok(user) => add_user_extensions(&mut installed, user.unwrap_or_default()),
Err(error) => eprintln!("[extensions] scanning the user extensions: {error:#}"),
}
viewlet.installed = installed;
self.sync_language_packs();
+ scanned
}
/// The `Extension`s of the installed list (`extensionsWorkbenchService.local`) with their enablement and runtime state.
diff --git a/native/crates/app/src/workbench/user_data_profile.rs b/native/crates/app/src/workbench/user_data_profile.rs
index cb0fcc425f4..4b5e84435a5 100644
--- a/native/crates/app/src/workbench/user_data_profile.rs
+++ b/native/crates/app/src/workbench/user_data_profile.rs
@@ -336,6 +336,7 @@ impl Workbench {
if let Some(user) = self.extensions_viewlet.user.as_mut() {
user.extensions_file = profile.extensions_resource.clone();
}
+ self.watch_profile_extensions();
self.rescan_installed_extensions();
self.configuration_changed(&change, before, cx);
if restart {
diff --git a/port/fixtures/extensions/install-tests/tests/index.js b/port/fixtures/extensions/install-tests/tests/index.js
index 8860e8d5491..b5202a9ce1f 100644
--- a/port/fixtures/extensions/install-tests/tests/index.js
+++ b/port/fixtures/extensions/install-tests/tests/index.js
@@ -1,5 +1,6 @@
// Installs and uninstalls the VSIX files in PORT_VSIX_DIR through the workbench commands, in the running host.
const assert = require('assert');
+const { execFileSync } = require('child_process');
const fs = require('fs');
const http = require('http');
const path = require('path');
@@ -26,6 +27,15 @@ const checks = {
await vscode.commands.executeCommand('workbench.extensions.uninstallExtension', 'port.vsix-cjs');
assert.strictEqual(vscode.extensions.getExtension('port.vsix-cjs'), undefined);
},
+ async 'the CLI installs into the running window and uninstalls from it'() {
+ const cli = (...args) => execFileSync(process.env.PORT_CLI, ['--user-data-dir', process.env.PORT_USER_DATA, ...args]);
+ cli('--install-extension', vsix('vsix-cjs.vsix').fsPath);
+ await until(() => vscode.extensions.getExtension('port.vsix-cjs'));
+ assert.ok(vscode.extensions.getExtension('port.vsix-cjs'));
+ cli('--uninstall-extension', 'port.vsix-cjs');
+ await until(() => !vscode.extensions.getExtension('port.vsix-cjs'));
+ assert.strictEqual(vscode.extensions.getExtension('port.vsix-cjs'), undefined);
+ },
async 'an Open VSX extension installs by id, verified, and activates'() {
if (!process.env.PORT_GALLERY) {
return;
diff --git a/port/ledger.md b/port/ledger.md
index 51ff204c99c..30f541bd7e8 100644
--- a/port/ledger.md
+++ b/port/ledger.md
@@ -32,7 +32,7 @@ Status: `open`, `in progress`, `waiting on Artur`, `later` (postponed), `done`,
| Milestones | M15 terminal, tasks, output | done | Integrated terminal (PTY from Rust, VT parser and renderer in GPUI), shell integration, extension terminals and pseudoterminals, tasks and problem matchers, npm/grunt/gulp/jake task providers, external terminal, Output panel and log viewer. Open gaps: the gaps column of its unit rows. | api-tests `terminal.test`, `terminal.shellIntegration.test` and `workspace.tasks.test` pass as in the reference (run with `SHELL=/bin/bash` as the baseline was); `npm: build` task from the fixture runs in a terminal. |
| Milestones | M16 debug and testing | in progress | Debug adapter protocol client, launch.json, breakpoints in the gutter, call stack, variables, watch, debug console, JS debugger (`ms-vscode.js-debug`), Test Explorer and test results. Open gaps: the gaps column of its unit rows. | api-tests `debug.test` and testing cases pass as in the reference; a breakpoint in a Node script from the fixture stops and shows variables. |
| Milestones | M17 webviews and notebooks | in progress | A WKWebView embedded in the GPUI window for webview panels, webview views and custom editors, with the upstream message and resource protocol; Markdown preview, image/media preview, simple browser, editor insets; notebooks (ipynb) with renderers and kernels. Open gaps: the gaps column of its unit rows. | api-tests `webview.test`, `customEditor` and `notebook*.test` cases pass as in the reference; Markdown preview of the fixture README draws next to its source. |
-| Milestones | M18 extensions: install, update, gallery | in progress | Extensions view backed by Open VSX, install/uninstall/update/disable, VSIX install, signature and checksum checks, recommendations, ESM extensions added after startup on Bun, language packs and display language. | Installing an extension from Open VSX activates it without restart (an ESM one included); api-tests `extensions.test` pass as in the reference. PORT_GALLERY=1 port/tools/extensions-check: 5 ok; MOCHA_GREP="vscode server cli" port/tools/api-tests: its one test pending, as in the reference (remote only). |
+| Milestones | M18 extensions: install, update, gallery | done | Extensions view backed by Open VSX, install/uninstall/update/disable, VSIX install, signature and checksum checks, recommendations, ESM extensions added after startup on Bun, language packs and display language. | Installing an extension from Open VSX activates it without restart (an ESM one included); api-tests `extensions.test` pass as in the reference. PORT_GALLERY=1 port/tools/extensions-check: 6 ok; MOCHA_GREP="vscode server cli" port/tools/api-tests: its one test pending, as in the reference (remote only). |
| Milestones | M19 product shell, privacy, accessibility, release | done | Welcome page and walkthroughs, update channel for the port's own builds, relaunch, splash, accessibility (VoiceOver through GPUI's accessibility tree, accessibility signals, high-contrast checks), process explorer and performance views, telemetry inert end to end, packaged and signed `.app`. Open gaps: the gaps column of its unit rows. | The telemetry source search (no telemetry endpoint string reachable) and network capture (zero outbound requests in a 10 min session with no user action) pass; VoiceOver reads the editor line and the Explorer rows; the signed `.app` passes `spctl -a`; benchmark rerun against a packaged reference build. |
| Milestones | M20 parity | in progress | Nothing new; close the gaps the earlier milestones left (the gaps column of the unit rows). Completion check in port-m20-check: api-tests met (318/28/0 in the target's suites, 4/0/0, port/results/api-tests.md); pixel-check met, the remaining differences are the causes in port/results/pixels.md; ledger not met: the `ported` rows, each with its open gaps. Closed in workbench/contrib/comments: comment threads in diff and multi diff editors, floating ones included, with the floating style's `FloatingWidgetRoom`. | `port/tools/api-tests` gives 318/28/0 (folder) and 4/0/0 (workspace): the reference baseline 356/46/0 less the suites and tests of removed features (chat, lm, the integrated browser, `env.remoteName`) (port/results/api-tests-reference.md); pixel-check of every window has no difference beyond anti-aliasing and the causes listed in `port/results/pixels.md`; every ledger row is `verified`, `removed` or `n/a`. |
| Milestones | M20 multi-instance code editor | open | Upstream every diff side, multi diff file side, notebook cell and walkthrough snippet is its own CodeEditorWidget; the port draws one editable code editor per group. Bound to that one instance today: `text_area` (workbench/editor_view.rs) and its `text_area_bounds`, the group's `viewport` (`EditorGroup`, editor.rs), `editor_focus` and its listeners (workbench.rs), `editors.active()` as the target of every editor command, the cursor, find and suggest, IME through `EntityInputHandler for Workbench` (text_input.rs), mouse selection in `editor_lines`, and the content widgets (hover, suggest, parameter hints, zone widgets) placed against that one area. Rows that need it: `workbench/contrib/multiDiffEditor` (its modified sides are read-only, upstream edits them in place); the diff editor's original pane, drawn by hand (`original_pane`, diff_editor_view.rs), which upstream can focus, select and search in; the stacked editors of notebook cells and the Editor Playground (port/notes.md, Stacked code editors), which draw every unfocused model as lines only and leave its rows exposed to the active editor's mouse handling. | N code editors with their own viewport, focus, cursor and widgets render in one group, and a multi diff modified side takes typing and undo. |
@@ -206,7 +206,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| platform/encryption | src/vs/platform | M10 | removed | | the port keeps secrets as Keychain items (MainThreadSecretState row, port/notes.md), so there is no safeStorage key to encrypt with |
| platform/endpoint | src/vs/platform | | removed | | no remote or tunnels by decision (port/notes.md); one local extension host |
| platform/environment | src/vs/platform | M10 | verified | | port/tools/settings-check environment: the paths and values init data carries match the reference except appName, uriScheme, machineId format and isTelemetryEnabled (product and no-telemetry decisions); argv.ts and argvHelper.ts are ported in argv.rs (`OPTIONS`, minimist parsing, `parseArgs`, `--goto` validation, help and version text), which cli.rs and `start_open_window` parse with (cargo test -p app argv:: : parses_the_command_line_as_upstream_argv, help_matches_upstream_text, goto_mode_validates_its_arguments); stdin.ts piped input decoded from the terminal encoding (resolveTerminalEncoding: cargo test -p app cli::); userDataPath.ts and the Electron main environment are replaced by main.rs's flags (`--user-data-dir`, `--extensions-dir`, `--profile`, `--profile-temp`, `--extensionDevelopmentPath`, `--extensionTestsPath`); copilotHome removed (no AI by decision) |
-| platform/extensionManagement | src/vs/platform | M18 | ported | [3 L] the workbench has no ExtensionsWatcher: a running app does not start or stop the extensions a CLI install or uninstall adds to or removes from `extensions.json` until it restarts | zip64 VSIX read as yauzl does (cargo test -p exthost zip::tests::reads_zip64_records_and_extended_information). VSIX and gallery install, update, uninstall and clean-up on disk (extensionsScannerService.ts, extensionsProfileScannerService.ts layout): cargo test -p exthost extension_management, zip; PORT_GALLERY=1 port/tools/extensions-check 5 ok (an ESM VSIX and redhat.vscode-yaml from Open VSX activate without restart); the extracted package.json is written as `JSON.stringify(manifest, null, '\t')`, strings untouched (cargo test -p exthost keeps_double_spaces_in_manifest_strings; port/tools/update-check pre-release installs the rust-analyzer pre-release, whose setting descriptions have two spaces in a row). The CLI (cliProcessMain.ts, extensionManagementCLI.ts): cli_process.rs runs `--list-extensions` (`--show-versions`, `--category`), `--install-extension` (ids, `id@version`, VSIX paths, `--force`, `--pre-release`), `--uninstall-extension`, `--update-extensions`, `--locate-extension` and `--install-source` with `--profile`, and exits without a window; a built-in is located and refused uninstalling, downloads follow `extensions.verifySignature` (cargo test -p app cli::tests::uninstall_extension_runs_in_the_cli_without_the_app cli_process::; `getAllDepsAndPackExtensions` for CLI, workbench gallery and workbench VSIX installs (a VSIX whose lookup fails installs alone): cargo test -p exthost dependencies_and_packs_come_along_recursively, cargo test -p app workbench::extension_management::tests, and the release CLI installs ms-python.isort with ms-python.python and its pack; the release binary as bin/code starts it installs, updates, lists, locates and uninstalls Open VSX extensions and a VSIX) |
+| platform/extensionManagement | src/vs/platform | M18 | verified | | extensionsWatcher.ts: the workbench watches the profile's `extensions.json` and starts and stops what another source installed or uninstalled (cargo test -p app extensions_installed_by_another_source_start_and_stop; port/tools/extensions-check `the CLI installs into the running window and uninstalls from it`). zip64 VSIX read as yauzl does (cargo test -p exthost zip::tests::reads_zip64_records_and_extended_information). VSIX and gallery install, update, uninstall and clean-up on disk (extensionsScannerService.ts, extensionsProfileScannerService.ts layout): cargo test -p exthost extension_management, zip; PORT_GALLERY=1 port/tools/extensions-check 6 ok (an ESM VSIX and redhat.vscode-yaml from Open VSX activate without restart); the extracted package.json is written as `JSON.stringify(manifest, null, '\t')`, strings untouched (cargo test -p exthost keeps_double_spaces_in_manifest_strings; port/tools/update-check pre-release installs the rust-analyzer pre-release, whose setting descriptions have two spaces in a row). The CLI (cliProcessMain.ts, extensionManagementCLI.ts): cli_process.rs runs `--list-extensions` (`--show-versions`, `--category`), `--install-extension` (ids, `id@version`, VSIX paths, `--force`, `--pre-release`), `--uninstall-extension`, `--update-extensions`, `--locate-extension` and `--install-source` with `--profile`, and exits without a window; a built-in is located and refused uninstalling, downloads follow `extensions.verifySignature` (cargo test -p app cli::tests::uninstall_extension_runs_in_the_cli_without_the_app cli_process::; `getAllDepsAndPackExtensions` for CLI, workbench gallery and workbench VSIX installs (a VSIX whose lookup fails installs alone): cargo test -p exthost dependencies_and_packs_come_along_recursively, cargo test -p app workbench::extension_management::tests, and the release CLI installs ms-python.isort with ms-python.python and its pack; the release binary as bin/code starts it installs, updates, lists, locates and uninstalls Open VSX extensions and a VSIX) |
| platform/extensionRecommendations | src/vs/platform | M18 | verified | | recommendation reasons and the workspace prompt text (extensionRecommendations.ts, extensionRecommendationNotificationService.ts): cargo test -p app recommendation; ui-pair port/fixtures/extensions/ui-recommendations.json (prompt, Recommended view) against the reference |
| platform/extensionResourceLoader | src/vs/platform | M18 | verified | | installed extensions' README, changelog and icon read from disk, gallery ones from their asset URIs (Open VSX has no `resourceUrlTemplate`): ui-pair port/fixtures/extensions/ui-view.json `details` shows the yaml README as the reference |
| platform/extensions | src/vs/platform | M18 | verified | | extensionValidator.ts with the cases of extensionValidator.test.ts: cargo test -p exthost extension_validator; installs validated in PORT_GALLERY=1 port/tools/extensions-check; built-in extensions are not validated yet |
@@ -391,7 +391,7 @@ One row per upstream unit, generated by `bun port/tools/gen-ledger.ts`; mileston
| workbench/services/editor | workbench service | M11 | verified | | editor groups (editor_grid.rs grid of gridview.ts, workbench/editor_groups.rs): split (Cmd+\, directions, orthogonal, `workbench.editor.splitSizing`, `openSideBySideDirection`), one text model per resource shared by its editors (editor.rs `SharedModel`), focus and move editors between groups, move group, close group and closeEmptyGroups, join, the 8 editor layouts, flip, even and expand widths, maximize group, group sashes with double click reset; groups reach the host as view columns (`$acceptEditorTabModel`, editorPosition); cargo test -p app editor_groups editor_grid host_sync; pixel-check window split (port/results/layout.md). group drag and drop (editor_groups.rs `group_drop_area`, `split_direction` of editorDropTarget.ts: cargo test -p app a_drag_splits_at_the_edges_and_moves_in_the_center) and the persisted editor part state (editor_groups/part_state.rs: cargo test -p app the_grid_and_its_editors_come_back_from_workspace_storage sticky_editors_come_back_sticky); verified: cargo test -p app editor_grid (grid.test.ts, gridview.test.ts); ui-pair hot-exit.json `restored` vs the reference (port/results/windows.md, milestone 11 verification): the editor part state with its untitled editor restored and focused; locked groups (editor_groups/locked_groups.rs): Lock/Unlock/Toggle Editor Group Lock, the Unlock and Lock Group title icons, the empty group toolbar, opening editors skipping a locked group (editorGroupFinder.ts), `workbench.editor.autoLockGroups`, `locked` stored: cargo test -p app editor_groups (a_locked_group_hands_opened_editors_to_an_unlocked_group, auto_lock_groups_locks_a_new_group_of_a_listed_editor), ui-pair editor-window-compact-lock.json (port/results/auxiliary-windows.md); external drops (dnd.ts `handleDrop`, `handleWorkspaceDrop`): cargo test -p app files_dropped_from_outside_open_in_the_group_the_overlay_shows folders_dropped_from_outside_enter_an_untitled_workspace |
| workbench/services/encryption | workbench service | M10 | removed | | proxy of platform/encryption, removed with it |
| workbench/services/environment | workbench service | M10 | verified | | the workbench environment's paths and args as init data and app paths (platform/environment row): port/tools/settings-check environment; environmentService.test.ts reads the browser workbench's URL options (web only); copilotHomeService removed by decision (no AI) |
-| workbench/services/extensionManagement | workbench service | M18 | verified | | installVSIX, install from Open VSX, uninstall, Install from VSIX and their errors: PORT_GALLERY=1 port/tools/extensions-check 5 ok; dependencies and pack members of a gallery or VSIX install queued before it: cargo test -p app workbench::extension_management::tests; enablement: cargo test -p app extension_enablement; trusted publishers (`checkForTrustedPublishers` before a gallery install, `extensions.trustedPublishers`, product.json `trustedExtensionPublishers`, Manage Trusted Extension Publishers: workbench/trusted_publishers.rs, cargo test -p app trusted_publishers; ui-pair port/fixtures/ui-steps/trusted-publisher.json against REF=~/Developer/vscode-ref-openvsx: the "Do you trust the publisher "MS-CEINTL"?" dialog matches, 3% of the dialog crop off where the product name rewraps the text) |
+| workbench/services/extensionManagement | workbench service | M18 | verified | | installVSIX, install from Open VSX, uninstall, Install from VSIX and their errors: PORT_GALLERY=1 port/tools/extensions-check 6 ok; dependencies and pack members of a gallery or VSIX install queued before it: cargo test -p app workbench::extension_management::tests; enablement: cargo test -p app extension_enablement; trusted publishers (`checkForTrustedPublishers` before a gallery install, `extensions.trustedPublishers`, product.json `trustedExtensionPublishers`, Manage Trusted Extension Publishers: workbench/trusted_publishers.rs, cargo test -p app trusted_publishers; ui-pair port/fixtures/ui-steps/trusted-publisher.json against REF=~/Developer/vscode-ref-openvsx: the "Do you trust the publisher "MS-CEINTL"?" dialog matches, 3% of the dialog crop off where the product name rewraps the text) |
| workbench/services/extensionRecommendations | workbench service | M18 | verified | | workspaceExtensionsConfig.ts from `.vscode/` and `.vsrustium/` (`.vsrustium/` wins per key), ignored recommendations: cargo test -p app recommendation; ui-pair port/fixtures/extensions/ui-recommendations.json |
| workbench/services/extensions | workbench service | M18 | verified | | extensionsProposedApi.ts `enabledApiProposals` filtering with product.json's allow-list and `--enable-proposed-api`, one policy per window (cargo test -p exthost proposed_api, cargo test -p app a_host_restart_gives_the_extensions); `_deltaExtensions` with `_activateAddedExtensionIfNeeded` and configuration defaults: port/tools/extensions-check, exthost-probe --install-vsix/--uninstall; other extension points the workbench reads (icon themes, static status bar items) are read at startup only |
| workbench/services/files | workbench service | M12 | verified | | the disk provider and watcher client run in process: native/crates/files (disk provider, FSEvents watcher, cargo test -p files); elevatedFileService.ts writeElevated is text_files.rs write_elevated of milestone 8 (port-integrate); verified: api-tests MOCHA_GREP="vscode API - (workspace|file system|env|types|tasks)" at 44a309311e1: every workspace, workspace-fs, workspace events, workspace-watcher and file system test passes, api-workspace 4/0/0 (port/results/api-tests.md "M12 verification"), workspace-fs and file system |
diff --git a/port/notes.md b/port/notes.md
index 34648a7cd75..9ab40994f79 100644
--- a/port/notes.md
+++ b/port/notes.md
@@ -737,6 +737,7 @@ Scope (roadmap section 18): extension management on disk with VSIX install and u
- Display language (`exthost/src/language_packs.rs`, `app/src/nls.rs`, `workbench/localization.rs`): `languagepacks.json` in the user data folder is rebuilt from installed extensions with `contributes.localizations`; at startup mainImpl.ts's locale (`--locale`, argv.json `locale`, else the OS's first preferred language, Chinese as zh-cn/zh-tw) resolves to an installed pack as base/node/nls.ts does for a product build (not VSCODE_DEV: the dev reference never translates). Extension manifests take the pack's `contents.package` or `package.nls.<locale>.json`; the host gets `appLanguage`; MainThreadLocalization answers `$fetchBuiltInBundleUri` and `$fetchBundleContents`. Configure Display Language lists installed packs and Open VSX's `category:"language packs"`, installs MS-CEINTL packs (others open in the Extensions view), asks to restart, writes argv.json and restarts; Clear Display Language Preference removes the key.
- Workbench strings: upstream looks messages up by module and key. Command Palette items carry the reference call's `module#key`: port/tools/ref-commands runs the reference from an APFS clone (ref-nls-clone.ts, in the temp folder, vscode-ref untouched) whose out/vs/nls.js tags each `localize`/`localize2` result with its key and the calling module from the stack, and `nls::localize_key` reads `contents[module][key]` of the pack. The same dump's `nlsKeys` map, per menu bar menu (by `MenuId` name), view and view container id, each item text or title to its key; `nls::localize_in(scope, text)` translates the menu bar's items (in `menu_actions`), side bar titles and pane headers through it, and a text with no key in its scope (a folder name, an extension's view) stays as it is. The top-level menus, the app menu and the Window menu take electron-main/menubar.ts's own keys (`main_label` in workbench/menubar.rs). A palette item without a key falls back to build.rs's index of every `localize`/`localize2` of src/vs (module, key, message): shortcut: there a message two modules translate differently gets the first module's text. shortcut: other surfaces (context menus, dialogs, view contents) still show English.
- The restart for the display language spawns the same binary with its arguments and working folder once this process exits; gpui's `App::restart` uses `open`, which loses the working folder of an unbundled binary.
+- ExtensionsWatcher (extensionsWatcher.ts, `onDidChangeExtensionsByAnotherSource`): the workbench watches the folder of the profile's `extensions.json` (a profile switch moves the watch) and reads it again 100 ms after its last change; enabled user extensions the host does not run start, running user extensions no longer installed stop, both as one `Job::Delta`. What this window installs already runs when its change arrives, so it makes no delta. A read that fails (a half-written file) makes no delta. main.rs creates the extensions folder at startup as main.ts `initServices` does, so the watch has a folder from the first run. extensions-check runs the release binary as the CLI against the running window's user data dir.
- `port/tools/extensions-check` needs a fresh `out-exthost`: `port/tools/build-exthost` first (a stale bundle fails the ESM check with "Cannot find package 'vscode'").
Handoff (branch `port-m18b-gallery`, after `docs(port): record milestone 18 extensions view and localization`):
diff --git a/port/tools/extensions-check b/port/tools/extensions-check
index 6abff54b548..78b9d90affb 100755
--- a/port/tools/extensions-check
+++ b/port/tools/extensions-check
@@ -19,7 +19,7 @@ overrides=$VSCODE_SRC/product.overrides.json
trap 'rm -f "$overrides"; rm -rf "$port_gui_lock"' EXIT
echo '{"trustedExtensionPublishers":["redhat"]}' >"$overrides"
code=0
-PORT_VSIX_DIR=$out VSCODE_DEV=1 VSCODE_GPUI_EXTENSIONS=$REF/extensions timeout 120 native/target/release/vsrustium --user-data-dir "$out/user-data" \
+PORT_VSIX_DIR=$out PORT_CLI=$PWD/native/target/release/vsrustium PORT_USER_DATA=$out/user-data VSCODE_DEV=1 VSCODE_GPUI_EXTENSIONS=$REF/extensions timeout 120 native/target/release/vsrustium --user-data-dir "$out/user-data" \
--extensionDevelopmentPath="$tests" --extensionTestsPath="$tests/tests" >"$out/log" 2>&1 || code=$?
grep -E '^(ok|FAILED) ' "$out/log" || cat "$out/log"
echo "exit $code"