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:
parent
7332aef585
commit
f1a2aab789
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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`).
|
||||
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.
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ export async function run(): Promise<void> {
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -10,10 +10,8 @@ import {
|
|||
REVISION_SCHEME,
|
||||
SOURCE_SCHEME,
|
||||
sourceFileUri,
|
||||
sourceFolderUri,
|
||||
sourcePathOf,
|
||||
} from "./sourceProvider";
|
||||
import { SOURCE_ROOT } from "./sources";
|
||||
|
||||
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.";
|
||||
};
|
||||
|
||||
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 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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue