Introduction¶
DSH Desktop has built-in code and plain text previews, but its positioning is viewing, not editing: it lacks features like completion, folding, automatic bracket pairing, and save conflict protection. To edit code in DSH, one must either jump to an external editor or tolerate the preview panel. DSH CodeCraft is designed to fill this gap.
The author is lllrunze, the plugin name is lllirunze/dsh-codecraft, the npm package name is dsh-codecraft, the current version is 0.2.2, and the license is MIT. Its approach is not to open a separate window, but to inject a CodeMirror 6 editor into DSH’s native workspace browser and file tabs, handling editing and saving through the host’s native tab flow.
Below is an introduction by function, installation, usage, and notes. It is worth noting that this plugin is categorized under “Client-side” in the SkillHub directory, and its manifest declares client-side injection and external dependencies, classifying it as a client-type plugin.
Core Features¶
Editor Basic Capabilities¶
- Syntax highlighting, line numbers, folding, search, line comments, indentation, undo/redo, and completion.
- Automatically close common brackets and quotes when pressing Enter, including selected wrapping, paired deletion, and language-specific backticks and Python triple quotes.
- Determine indentation based on Python syntax context on Enter: block, branch, multiline expression, closing delimiter.
- Indent width is selectable between two or four spaces, switchable in the same settings panel; changes only affect open editors, not rewriting existing file contents.
Python Smart Completion¶
- Python files enable semantic completion by default on macOS and Windows (v0.2.2).
- Uses the plugin’s built-in Pyright service, scope: workspace; prioritizes explicit interpreter or
.venv/venvin the workspace, with PATH fallback usingpython3on macOS andpythonon Windows. - Completion covers imports, cross-file symbols, inferred members, and packages in the selected environment.
- When accepting method, function, or constructor completion in a clear call context, it inserts
()and places the cursor inside the parentheses; assignment right side, callback parameters, containers, imports, decorators, existing snippets, and existing brackets remain unchanged. - The status bar will show
Starting,Ready/Unavailable; unavailability of the service does not affect normal editing and saving.
Google Style Docstring Placeholders¶
After typing """ and pressing Enter at the first statement position of a Python function, method, async function, or class, the plugin generates summary, Args, Returns / Yields placeholder content. It only generates when the syntax context is clear; module scope, assignment statements, nested blocks, subsequent statements, or triple quotes in prefixed strings remain regular multiline strings.
Save and Drafts¶
- Manual save
Cmd+S(macOS) orCtrl+S(Windows), or click the save action in the status bar. The save path has conflict protection: it can detect external changes and refuse to write stale content. - Auto-save is disabled by default, can be enabled in
Settings → CodeCraft, interval options: 10, 30, 60, 120 seconds. Auto-save and manual save share the same conflict-free write path. - Restore unsaved drafts after switching tabs, closing tabs, or refreshing the page.
- Preserve LF / CRLF, UTF-8 BOM, and POSIX file permission bits on supported platforms.
Security Boundaries¶
- Files are edited locally only; no model calls, telemetry, or file uploads.
- Automatically reject files that are too large, binary, non-UTF-8, or have mixed line endings.
- Limit to 2 MiB for UTF-8 source code and text files.
Installation and Enablement¶
Environment Requirements¶
| Component | Requirement |
|---|---|
| Basic Editor | macOS or Windows |
| Python Intelligence | v0.2.2 only macOS or Windows |
| DSH Desktop | 0.2.1-rc.5 |
| Node.js | 20 or higher required when building from source |
Linux is not verified and is currently unsupported.
Install from npm¶
dsh plugin --profile desktop add dsh-codecraft@latest
Restart DSH Desktop after installation. The plugin manifest will automatically add CodeCraft to the selected DSH profile; no manual profile modification is needed.
Install from source¶
git clone https://github.com/lllirunze/dsh-codecraft.git
cd dsh-codecraft
npm install
npm run check
dsh plugin --profile desktop add "$PWD"
npm run check runs typecheck, test, build, and verify sequentially. Restart DSH Desktop after installation.
Update and Uninstall¶
dsh plugin --profile desktop update --latest dsh-codecraft
Or specify a version:
dsh plugin --profile desktop add dsh-codecraft@0.2.2
Uninstall:
dsh plugin --profile desktop remove dsh-codecraft
Restart DSH Desktop after uninstalling; the native file preview will automatically restore. The plugin currently has no in-app update notifications or silent background updates; installation and updates are handled by the DSH CLI.
Typical Usage¶
- Open a supported source or text file in the DSH workspace browser.
- DSH opens a native file tab and selects the CodeCraft renderer.
- Edit directly, press
Cmd+SorCtrl+S, or click the save action in the status bar. - When you need to view the original content, use the viewer menu at the top of the tab to switch back to DSH’s native code or plain text preview.
To enable auto-save: go to Settings → CodeCraft and select a 10 / 30 / 60 / 120 second interval. To adjust indent width, change it in the same settings area; Python files additionally enjoy syntax-aware Enter indentation.
Keyboard shortcuts (macOS vs Windows):
| macOS | Windows | Action |
|---|---|---|
Cmd+S |
Ctrl+S |
Save current file |
Cmd+F |
Ctrl+F |
Search within file |
Cmd+/ |
Ctrl+/ |
Toggle line comment |
Cmd+Z / Cmd+Shift+Z |
Ctrl+Z / Ctrl+Y |
Undo / Redo |
Tab / Shift+Tab |
Tab / Shift+Tab |
Increase / Decrease indent |
| — | Ctrl+Space |
Open completion manually |
macOS does not bind the Option key combination because it may generate combined input characters. Ctrl+Space is available in environments where the operating system does not occupy it.
Applicable Scenarios and Notes¶
Suitable for those who want to edit .py or common text source code directly in DSH Desktop and wish to keep editing actions within the native tab and workspace flow. Mac and Windows users can use Python semantic completion; scenarios that only involve viewing or plain text editing are sufficient with the native preview and do not require this plugin.
According to DSH’s plugin model, plugins run with the current DSH process permissions and can declare injection of client modules via the manifest. This plugin’s manifest declares inject items (dsh-client-locale, dsh-client-ui-settings, dsh-client-ui-settings-plugins, dsh-client-ui-sidebar-right, dsh-client-ui-sidebar-documentpreview) and external dependencies (dsh-client-ui-primitives, react, react/jsx-runtime). It is recommended to check the source code and license (MIT) before installing to decide whether to load it.
Two compatibility notes confirmed by documentation:
- If a plugin modifying the DSH sidebar file area is installed (e.g.,
dsh-better-sidebar), it may replace or intercept the nativeFilescontent, causing CodeCraft to fail to obtain the normal native file tab flow. The solution is to go into that sidebar plugin’s settings, disable its effect onFiles, restart DSH Desktop if necessary, and then open files from the nativeFilessidebar to confirm. - Troubleshooting order suggestion: First confirm which native interface of DSH is being replaced or intercepted by another plugin, and prioritize configuring that plugin to not interfere with the native flow required by this plugin.
Limitations: Symbolic links are read-only; Python hover, signature help, diagnostics, cross-file auto-edit, and goto definition are not yet provided; Linux is not supported; no cross-window draft synchronization.
Conclusion¶
DSH CodeCraft puts editing capabilities into DSH’s native file tabs, relying on native workspace permissions and the save chain for conflict protection and draft recovery, rather than creating a separate editor interface. Its value lies in making “editing code in DSH” unnecessary to exit the host environment. Currently maintained at version 0.2.2, with Linux and several Python semantic features still missing.
Directory: https://www.skillhub.cn/plugins/lllirunze/dsh-codecraft
GitHub: https://github.com/lllirunze/dsh-codecraft
Docs: https://github.com/lllirunze/dsh-codecraft/tree/master/docs