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>
This commit is contained in:
Steve Biedermann 2026-11-03 17:42:13 +01:00
parent 7332aef585
commit f1a2aab789
5 changed files with 7 additions and 40 deletions

View File

@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.
### Changed ### 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 - Show the image's editable virtual `source` filesystem automatically in the
VS Code Explorer without adding a workspace folder. VS Code Explorer without adding a workspace folder.
- Require an explicit `runa-cli` subcommand: `repl` starts the interactive - Require an explicit `runa-cli` subcommand: `repl` starts the interactive

View File

@ -102,8 +102,10 @@ The image owns actor source text. On connect, **Runa Image Sources** automatical
shows its virtual filesystem beneath `source` (`runa-image://<endpoint>/source`). shows its virtual filesystem beneath `source` (`runa-image://<endpoint>/source`).
No workspace changes, folder prompt, or extension restart is required. No workspace changes, folder prompt, or extension restart is required.
Opening a file reads it from the image; saving writes back to the image. 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 The extension never adds image folders to the workspace. VS Code's public API
if a regular workspace mount is desired. Directories are derived from 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 source paths: `actors/counter` appears as `source/actors/counter.rn`. Source
paths are canonical and exclude the `source/` prefix and `.rn` suffix. paths are canonical and exclude the `source/` prefix and `.rn` suffix.

View File

@ -8,6 +8,7 @@ export async function run(): Promise<void> {
const folders = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.toString()); const folders = vscode.workspace.workspaceFolders?.map((folder) => folder.uri.toString());
try { try {
await vscode.commands.executeCommand("runa.connect", image.address); await vscode.commands.executeCommand("runa.connect", image.address);
assert.ok(!(await vscode.commands.getCommands(true)).includes("runa.addSourceFolder"));
assert.deepEqual( assert.deepEqual(
vscode.workspace.workspaceFolders?.map((folder) => folder.uri.toString()), vscode.workspace.workspaceFolders?.map((folder) => folder.uri.toString()),
folders, folders,

View File

@ -55,12 +55,6 @@
"category": "Runa", "category": "Runa",
"icon": "$(refresh)" "icon": "$(refresh)"
}, },
{
"command": "runa.addSourceFolder",
"title": "Add Source Folder to Workspace",
"category": "Runa",
"enablement": "runa.connected"
},
{ {
"command": "runa.spawn", "command": "runa.spawn",
"title": "Spawn Actor", "title": "Spawn Actor",
@ -210,10 +204,6 @@
"when": "view == runa.actors && runa.connected", "when": "view == runa.actors && runa.connected",
"group": "navigation" "group": "navigation"
}, },
{
"command": "runa.addSourceFolder",
"when": "view == runa.actors && runa.connected"
},
{ {
"command": "runa.disconnect", "command": "runa.disconnect",
"when": "view == runa.actors && runa.connected" "when": "view == runa.actors && runa.connected"

View File

@ -10,10 +10,8 @@ import {
REVISION_SCHEME, REVISION_SCHEME,
SOURCE_SCHEME, SOURCE_SCHEME,
sourceFileUri, sourceFileUri,
sourceFolderUri,
sourcePathOf, sourcePathOf,
} from "./sourceProvider"; } from "./sourceProvider";
import { SOURCE_ROOT } from "./sources";
let closeConnections: (() => Promise<void>) | undefined; let closeConnections: (() => Promise<void>) | undefined;
@ -213,31 +211,6 @@ export function activate(context: vscode.ExtensionContext): { sourceTree: ImageS
: "No actors. Spawn a .rn file from the source folder."; : "No actors. Spawn a .rn file from the source folder.";
}; };
const addSourceFolder = async (target?: string): Promise<boolean> => {
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<void>((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 connect = async (target?: string) => {
const address = const address =
target ?? target ??
@ -658,7 +631,6 @@ export function activate(context: vscode.ExtensionContext): { sourceTree: ImageS
command("runa.connect", connect), command("runa.connect", connect),
command("runa.disconnect", disconnect), command("runa.disconnect", disconnect),
command("runa.refresh", refresh), command("runa.refresh", refresh),
command("runa.addSourceFolder", () => addSourceFolder()),
command("runa.inspect", inspect), command("runa.inspect", inspect),
command("runa.spawn", spawn), command("runa.spawn", spawn),
command("runa.spawnSource", spawnSource), command("runa.spawnSource", spawnSource),