# dsh-open-in-vscode

> Add an "Open in VSCode" option to the right-click menu in the DSH web interface workspace. Clicking it opens the workspace directory in the local VS Code, eliminating the need to manually locate the path.

## Metadata

- Author: [@omdsh-dev](https://github.com/omdsh-dev)
- Repo: <https://github.com/omdsh-dev/dsh-open-in-vscode.git>
- GitHub: [omdsh-dev/dsh-open-in-vscode](https://github.com/omdsh-dev/dsh-open-in-vscode)
- Stars: 53
- Language: JavaScript
- License: [MIT](https://spdx.org/licenses/MIT.html)
- Topics: `dsh`, `dsh-plugin`
- Forks: 7
- Open Issues: 0
- Last push: 2026-08-16T05:24:58.000Z
- Added: 2026-08-13T00:00:00.000Z

## Install

```bash
dsh plugin --profile web add github:omdsh-dev/dsh-open-in-vscode
```

## Wiki

## One-liner

In DeepSeek Harness's web interface, adds an "Open in VSCode" option to the "..." menu of each workspace in the sidebar. Clicking it opens that workspace's directory in the local VS Code, eliminating the need to manually copy the path and run commands in the terminal.

## Core Features

- Injects an editor entry into the overflow menu of workspace rows, with icon and hover styling following the interface theme
- Clicking it directly launches the editor to open that workspace's directory, with the menu automatically closing first
- Menu text adapts to the interface language: Chinese shows "在 VSCode 中打开", English shows "Open in VSCode"
- Supports replacing the editor command with any other editor besides VS Code, with additional launch arguments supported
- On Windows, when using the default command, automatically searches common VS Code installation directories without requiring PATH to be configured
- The editor is launched as an independent process; restarting or exiting the DSH service will not close any already-open editor windows

## Technical Implementation

- **Language**: TypeScript (including React TSX client components)
- **Key Dependencies**: zod (data validation), @deepseek-ai/dsh-typert-protocol (client-server communication channel), @deepseek-ai/dsh-client-ui-slots (UI slots), react
- **Architecture Pattern**: The plugin is divided into server-side and browser-side halves. The server registers a strictly validated remote call endpoint `openInVscode/open`, launching the editor via Node child process in detached mode; the browser-side registers the menu item into the host's `sidebar.workspaces.row-menu` slot, and on click passes the directory path to the server through this endpoint. If the host version doesn't provide this slot yet, a DOM-observation-based compatibility adapter is enabled and automatically removed when the native slot is detected.
- **Entry Files**: `src/index.ts` (server-side), `src/client/index.ts` (browser-side)

## Use Cases

Suitable for people who frequently switch between multiple workspaces in the DSH web interface and need to view the same code in an editor. The previous approach was to copy the workspace directory path, then switch to a terminal or file manager to open it—this plugin compresses that step into a single menu click. The prerequisite is that the editor and DSH server run on the same machine.

## Prerequisites and Compatibility

| Dependency | Minimum Version | Description |
|---|---|---|
| Node.js | ^22.19 or >=24 | Server runtime environment requirement |
| DSH | Manifest declares >=0.0.1, docs recommend 0.1.0-rc.6 and above | Uses native workspace menu slot when available, compatibility adapter for rc.6 |
| Platform | macOS / Windows / Linux | Server uses only Node built-in capabilities; Windows has additional installation directory detection for the default `code` command |
| UI Mode | Web interface only | The plugin's client portion declares web platform; no menu under CLI/terminal interface |
| VS Code or Other Editor CLI | None | Requires an executable that can accept a directory argument, default is `code`; macOS needs VS Code's command line tool installed first |
| Native Modules | None | No dependencies on any compiled native extensions |

## Installation

```bash
dsh plugin --profile web add github:omdsh-dev/dsh-open-in-vscode
```

## Configuration Options

| Option | Type | Description | Default |
|---|---|---|---|
| command | string | The editor executable to open directories, can be replaced with any editor command | `code` |
| args | string array | Additional launch arguments passed to the editor before the directory path | `[]` |

Configuration is written in DSH's cordis.yml and will be validated. Errors with fix suggestions are reported when the executable cannot be found.

## FAQ

**Q: The "Open in VSCode" option doesn't appear in the menu after installation. What should I do?**

A: After installing the plugin, you need to restart the web server and refresh the page for the menu item to appear. The documentation explicitly requires graceful exit with `kill -TERM` before restarting, not `kill -9`.

**Q: Clicking does nothing. How do I troubleshoot?**

A: Failure messages are only printed to the browser console, not shown as UI prompts. Open the browser developer tools and look for errors starting with `[dsh-open-in-vscode]`. The most common cause is the editor command not being in PATH.

**Q: macOS says it can't find the code command. How do I fix it?**

A: You need to install VS Code's command line tool first (Shell Command: Install 'code' command in PATH), or change the plugin's command to another editor command that can open directories.

**Q: Can I use an editor other than VS Code?**

A: Yes, change the command to any executable that can accept a directory argument. You can also use args to append additional arguments. Note that only the default `code` command has automatic installation directory detection on Windows; other commands must be findable in PATH.

**Q: Will the editor open on my computer or on the server?**

A: It opens on the machine running the DSH server. If you're accessing DSH on another machine via browser remotely, the editor window will appear on that server, not on your local machine.

**Q: Does this plugin read/write my files or get called by the model?**

A: No. It only launches the editor process when you manually click the menu. It doesn't read or write files itself, and hasn't registered any tools or skills—models cannot see or call it.

**Q: Will the editor close when I shut down the DSH server?**

A: No. The editor is launched as a detached process, separating from the server after startup. Server exit does not affect already-open editor windows.

**Q: Why do some workspace rows not have this menu item?**

A: Only workspaces with actual directory paths will render this menu item; rows without directory information are skipped.

## Difficulty Level

Beginner — Just install, restart the server, refresh the page, and it's ready to use. The default configuration targets VS Code. You only need to touch the configuration when changing editors or when macOS doesn't have the `code` command installed.

## Known Issues and Limitations

- Launch failures only output error logs to the browser console with no visible UI prompt, making it easy for regular users to think "clicking does nothing" (`src/client/row.tsx:71-73`)
- The editor launches on the machine where the DSH server runs; in remote access scenarios, it cannot open directories on the local machine where the browser is running (`src/runtime.ts:37`)
- Only accepts absolute paths; relative paths are directly rejected with an error (`src/runtime.ts:86-88`)
- Workspace rows without directory paths do not display this menu item (`src/client/row.tsx:65`)
- The compatibility adapter for older host versions relies on DOM observation and identifies workspace menus by two menu text items ("Rename" / "Delete"); host UI text or structural changes may cause identification to fail (`src/client/legacy-menu.tsx:60-63`)
- Windows installation directory auto-detection only applies to the default `code` command; custom commands still need to be ensured resolvable via PATH (`src/resolve.ts:53`)
- The error message for VS Code not found on Windows hardcodes an old version number `0.1.5`, which doesn't match the current package version and can cause confusion during troubleshooting (`src/runtime.ts:51`)
- The client declares only the web platform; this feature is unavailable in non-web interface modes (`package.json:28-36`)

---

This document is auto-generated by [deepseek-plugin.org](https://deepseek-plugin.org). HTML page: [dsh-open-in-vscode](https://deepseek-plugin.org/plugins/omdsh-dev/dsh-open-in-vscode)
Wiki generated by AI (model: `MiniMax-M2.7`)
