From f1a2aab789da478df8062a00c9752ff543be7b10 Mon Sep 17 00:00:00 2001 From: Steve Biedermann Date: Tue, 3 Nov 2026 17:42:13 +0100 Subject: [PATCH] fix: remove image workspace folder mounting Remove the obsolete source-folder command and all workspace mutation code. Keep automatic Explorer browsing backed by the image filesystem provider and verify the command is no longer registered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 2 ++ vscode/README.md | 6 ++++-- vscode/integration/host.ts | 1 + vscode/package.json | 10 ---------- vscode/src/extension.ts | 28 ---------------------------- 5 files changed, 7 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0de146..06bd42a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file. ### Changed +- Remove the VS Code Add Source Folder to Workspace command; image files are + accessed exclusively through the automatic image-source Explorer view. - Show the image's editable virtual `source` filesystem automatically in the VS Code Explorer without adding a workspace folder. - Require an explicit `runa-cli` subcommand: `repl` starts the interactive diff --git a/vscode/README.md b/vscode/README.md index 389b139..248d5bf 100644 --- a/vscode/README.md +++ b/vscode/README.md @@ -102,8 +102,10 @@ The image owns actor source text. On connect, **Runa Image Sources** automatical shows its virtual filesystem beneath `source` (`runa-image:///source`). No workspace changes, folder prompt, or extension restart is required. Opening a file reads it from the image; saving writes back to the image. -The optional **Runa: Add Source Folder to Workspace** command is still available -if a regular workspace mount is desired. Directories are derived from +The extension never adds image folders to the workspace. VS Code's public API +does not support overlaying virtual files onto the built-in workspace file tree, +so image files appear in their own Explorer view backed by the filesystem provider. +Directories are derived from source paths: `actors/counter` appears as `source/actors/counter.rn`. Source paths are canonical and exclude the `source/` prefix and `.rn` suffix. diff --git a/vscode/integration/host.ts b/vscode/integration/host.ts index 1b83fb1..d645339 100644 --- a/vscode/integration/host.ts +++ b/vscode/integration/host.ts @@ -8,6 +8,7 @@ export async function run(): Promise { const folders = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.toString()); try { await vscode.commands.executeCommand("runa.connect", image.address); + assert.ok(!(await vscode.commands.getCommands(true)).includes("runa.addSourceFolder")); assert.deepEqual( vscode.workspace.workspaceFolders?.map((folder) => folder.uri.toString()), folders, diff --git a/vscode/package.json b/vscode/package.json index a459563..3c87a86 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -55,12 +55,6 @@ "category": "Runa", "icon": "$(refresh)" }, - { - "command": "runa.addSourceFolder", - "title": "Add Source Folder to Workspace", - "category": "Runa", - "enablement": "runa.connected" - }, { "command": "runa.spawn", "title": "Spawn Actor", @@ -210,10 +204,6 @@ "when": "view == runa.actors && runa.connected", "group": "navigation" }, - { - "command": "runa.addSourceFolder", - "when": "view == runa.actors && runa.connected" - }, { "command": "runa.disconnect", "when": "view == runa.actors && runa.connected" diff --git a/vscode/src/extension.ts b/vscode/src/extension.ts index c6add51..f716200 100644 --- a/vscode/src/extension.ts +++ b/vscode/src/extension.ts @@ -10,10 +10,8 @@ import { REVISION_SCHEME, SOURCE_SCHEME, sourceFileUri, - sourceFolderUri, sourcePathOf, } from "./sourceProvider"; -import { SOURCE_ROOT } from "./sources"; let closeConnections: (() => Promise) | undefined; @@ -213,31 +211,6 @@ export function activate(context: vscode.ExtensionContext): { sourceTree: ImageS : "No actors. Spawn a .rn file from the source folder."; }; - const addSourceFolder = async (target?: string): Promise => { - const address = target ?? endpoint; - if (!address) throw new Error("Connect to a local image first"); - const uri = sourceFolderUri(address); - const folders = vscode.workspace.workspaceFolders ?? []; - if (folders.some((folder) => folder.uri.toString() === uri.toString())) return true; - const previous = folders.findIndex((folder) => folder.uri.scheme === SOURCE_SCHEME); - const changed = new Promise((resolve) => { - const subscription = vscode.workspace.onDidChangeWorkspaceFolders(() => { - subscription.dispose(); - resolve(); - }); - }); - const folder = { uri, name: SOURCE_ROOT }; - // Replacing the first folder would restart extensions, so earlier images stay mounted there. - const updated = - previous > 0 - ? vscode.workspace.updateWorkspaceFolders(previous, 1, folder) - : vscode.workspace.updateWorkspaceFolders(folders.length, 0, folder); - if (!updated) throw new Error("VS Code rejected adding the image source folder"); - await changed; - output.appendLine(`Mounted ${uri.toString(true)} as workspace folder "${SOURCE_ROOT}"`); - return true; - }; - const connect = async (target?: string) => { const address = target ?? @@ -658,7 +631,6 @@ export function activate(context: vscode.ExtensionContext): { sourceTree: ImageS command("runa.connect", connect), command("runa.disconnect", disconnect), command("runa.refresh", refresh), - command("runa.addSourceFolder", () => addSourceFolder()), command("runa.inspect", inspect), command("runa.spawn", spawn), command("runa.spawnSource", spawnSource),