Wash for VS CodeA Unix-like terminal for VSCode for Web, powered by Wash. Run common shell commands and work with workspace files in your browser.
Getting startedThe extension ID is
Use ↑ and ↓ for command history. Home, End, Delete, Ctrl+A, Ctrl+E, Ctrl+U, Ctrl+K, Ctrl+W, and Ctrl+L edit the command line. Tab completes command names and paths. Pasted lines run in order. Bundled
|
| Location | Behavior |
|---|---|
/workspace |
With one folder, Wash mounts it here and starts in this directory. With multiple folders, each appears at /workspace/<folder-name>. |
/etc, /home, /usr/bin |
Stored in extension storage and shared by later terminals. |
/tmp |
Separate for each terminal. |
With no workspace mount, a new terminal starts in its home directory. To run a shell script by name, place it in ~/bin and use chmod +x ~/bin/script. Wash stores the permission in extension storage and preserves it across renames within the same persistent mount.
Settings
Set wash.workspaceMount in VS Code Settings. Changes apply to terminals opened afterward.
| Value | Workspace access |
|---|---|
readWrite (default) |
Read and write workspace files. |
readOnly |
Read workspace files. |
disabled |
Skip mounting workspace folders. |
wash.history.persistence controls command history. The default, persistent, saves history to ~/.wash_history and restores it in new terminals, as bash does with ~/.bash_history. session keeps history only while the terminal is open. wash.history.size sets the number of saved commands (default 1000). Commands that start with a space and repeated commands are not added.
Register a command from another extension
Activate kmmz1127.vscode-wash and use its registerCommand API. Registered commands and aliases take effect from the next input line, including in terminals that are already open. Type definitions are in src/api.ts, which depends only on vscode.
- Command and alias names may contain letters, digits,
_,+, and-.registerCommandandregisterAliasthrow when the name is already registered. - A command can use
fsin its context to access files in the Wash path space, andexecto run a line in the same shell. ctx.toUri(path)converts a Wash path to avscode.Uri, for example to show diagnostics. It returnsundefinedfor in-memory paths such as/tmp.- A command can set
description, shown in completion lists, andcomplete(args, ctx), which returns candidates for the word being typed. api.versionreports the API version. The current version is1. See docs/api.md for the versioning policy.
const wash = vscode.extensions.getExtension("kmmz1127.vscode-wash");
if (wash) {
const api = await wash.activate();
context.subscriptions.push(api.registerCommand({
name: "hello",
run: async (args: string[]) => ({
stdout: `hello ${args.join(" ")}\n`,
stderr: "",
exitCode: 0,
}),
}));
}
Limitations
- The browser build currently excludes gzip-related commands.
- Interactive input requires a command that uses Wash's terminal I/O API. Programs such as Like-C can declare browser requirements of their own.
Development
npm ci
npm run web
Use npm run typecheck and npm run test:web for local checks. In desktop VS Code, Run Web Extension launches a Web extension development host. To build an unpublished VSIX, run npm exec --package @vscode/vsce -- vsce package --no-dependencies. The VSIX includes the browser bundle and notices.
See the requirements, design, and release tasks.
Bug reports and feature requests
Include the browser version, the command you ran, and a minimal reproduction. vscode-wash issues
License
MIT. See THIRD_PARTY_NOTICES for the licenses included with the browser bundle.