DSH follows the “everything is a plugin” philosophy. This plugin embeds a pinned version of code-server (VS Code Web) in the DSH center area view, supporting the full capabilities of code-server such as installing extensions and browsing/editing files; it provides two server sources, pinned or custom binaries, port and directory configuration, installation progress, and hot switching.
Core Features¶
Instance Pool and Hot Switching¶
The plugin uses an instance pool mechanism to manage code-server instances: instances are cached by workspace, switching between sessions in the same space hits the same instance, achieving zero reload. When the instance pool is full (default limit 2), a dialog appears letting the user choose an instance to evict, and the evicted instance is fully destroyed.
Server Sources and Configuration¶
Two server sources are supported:
- pinned: Uses the fixed version bundled with the plugin.
- custom: Uses a binary path specified by the user.
Users can configure the port, workspace directory, a switch for making the opened directory follow the current space, and the instance pool limit.
UI Interaction and Layout¶
- Theme following: Automatically follows DSH’s dark theme or VS Code’s light theme.
- Focus layout: Enabled by default. Newly opened VS Code enters by default with the “secondary sidebar (right-side Codex panel) maximized”, hiding the status bar and welcome page, while keeping the activity bar.
- Trust opened directory: Enabled by default, disabling Restricted Mode to ensure that extensions such as Codex are available in the directory.
Version Iteration Fixes¶
- 0.1.8: Automatically supplements built-in extension resources, resolving a black screen issue caused by missing browser-side bundle in code-server 4.135.0.
- 0.1.19 - 0.1.23: Continuously fixes features related to instance pool, layout initialization, theme-follow convergence, trusted directories, and default positioning of the secondary sidebar.
Installation and Enablement¶
Installing the plugin requires a Node.js >= 20 environment. The installation process is as follows:
- Go to the DSH repository directory.
- Install the plugin package (append the plugin line to the profile layer stack).
cd <dsh 仓库>
pnpm dsh plugin --profile web add <本插件目录>/dsh-vscode-bridge-0.1.20.tgz
- Restart dsh web (it is recommended to restart detached from the terminal to persist logs).
bash <本插件目录>/scripts/restart-dsh-web.sh <dsh 仓库> <工作区>
Typical Usage¶
After installation, the plugin will show a tab in DSH’s native right sidebar (better-sidebar 0.19+ / DSH 0.1.5 host) or the center area view.
- Configure server: In the sidebar gear → “VS Code Server” settings page, select the server mode (pinned or custom), and configure the port and directory.
- Session switching: When switching sessions within the same DSH space, the VS Code page maintains its current state or achieves zero reload, without cold-starting again.
- Use focus mode: Disable the “Focus layout” switch on the settings page, or manually adjust the layout in VS Code; subsequent opens of that directory will retain the user’s custom layout.
Application Scenarios and Notes¶
- Environment dependencies: Requires specific files in the installation directory (such as
cordis.patch.yml,dsh.plugin.json, etc.) and the official tarball of code-server 4.135.0 (the plugin will automatically supplement built-in extension resources). - Debugging isolation: For independent debugging, use the
DSH_VSCODE_BRIDGE_WORKSPACEenvironment variable to override the plugin’s workspace root, enabling separate profile/port. - Version management: When upgrading versions, repackage the tgz and reinstall + restart according to the above steps.