Skip to main content
L

dsh-codecraft

lllirunze/dsh-codecraft

A lightweight, DSH-native code editor with intelligent coding assistance, minimizing reliance on external IDEs.

Install

dsh plugin --profile web add github:lllirunze/dsh-codecraft

README

DSH CodeCraft

A precise, safe CodeMirror 6 editor inside DSH's native file tabs.

npm version DSH compatibility CI platforms license

English · 简体中文 · Documentation

Status: v0.2.1 adds Python syntax-aware indentation while preserving Python Intelligence on macOS and Windows.

Features

  • Uses DSH's native workspace explorer and file tabs.
  • Provides syntax highlighting, line numbers, folding, search, line comments, indentation, undo/redo, and completion.
  • Provides project-aware Python completion for imports, cross-file symbols, inferred members, and packages from the selected environment on macOS and Windows.
  • Synchronizes unsaved Python content with a workspace-scoped Pyright language server managed through DSH's subprocess service.
  • Automatically closes common brackets and quotes, including selection wrapping, paired deletion, and language-aware backticks or Python triple quotes.
  • Provides configurable two- or four-space indentation, generic bracket expansion on Enter, and aligned single- or multiline Tab operations.
  • Uses Python syntax context for block, branch, multiline-expression, and closing-delimiter indentation.
  • Offers optional auto save in DSH Settings with 10, 30, 60, or 120-second intervals; it is disabled by default.
  • Saves with Cmd+S on macOS or Ctrl+S on Windows and reports dirty, saving, saved, failed, and read-only states.
  • Detects external changes and refuses stale writes.
  • Restores unsaved drafts after tab switches, tab closure, or page reloads.
  • Preserves LF/CRLF, UTF-8 BOM, and POSIX file mode where supported.
  • Safely rejects files that are too large, binary, non-UTF-8, mixed-line-ending, or otherwise unsafe to edit.
  • Performs editing locally without model calls, telemetry, or file uploads.

Requirements

ComponentSupported
Base editormacOS or Windows
Python IntelligencemacOS or Windows in v0.2.1
DSH Desktop0.2.1-rc.5
Node.js20 or later when building from source

Install

Install from npm

dsh plugin --profile desktop add dsh-codecraft@latest

Restart DSH Desktop after installation.

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"

Restart DSH Desktop after installation. The plugin manifest automatically adds CodeCraft to the selected DSH profile; no manual profile editing is required.

Update

Update an npm installation to the latest published version:

dsh plugin --profile desktop update --latest dsh-codecraft

Alternatively, installing an explicit version replaces the currently selected version:

dsh plugin --profile desktop add dsh-codecraft@0.2.1

Restart DSH Desktop after updating.

For a local source installation, pull the new source, rebuild it, and refresh the profile dependency:

git pull
npm install
npm run check
dsh plugin --profile desktop add "$PWD"

CodeCraft does not currently provide in-app update notifications or automatic background updates. Installation and updates are managed by the DSH CLI.

Uninstall

dsh plugin --profile desktop remove dsh-codecraft

Restart DSH Desktop. Native file previews are restored automatically.

Usage

  1. Open a supported source or text file from DSH's workspace explorer.
  2. DSH opens its native file tab and selects the CodeCraft renderer.
  3. Edit the file and press Cmd+S on macOS or Ctrl+S on Windows, or use the Save action in the status bar.
  4. Use the viewer menu above the tab to switch to DSH's native Code or Plain Text preview when needed.

Auto save is disabled by default. Open Settings → CodeCraft from the settings sidebar to enable it and choose a 10, 30, 60, or 120-second interval. Automatic and manual saves use the same conflict-safe write path.

New indentation always uses spaces. In the same settings section, choose a width of two or four spaces; the change applies to open editors without rewriting existing file content. Python files additionally use syntax-aware Enter indentation for blocks, branches, and multiline expressions.

Python Intelligence is enabled by default for Python files on macOS and Windows. CodeCraft uses its bundled Pyright server and first selects an explicit interpreter or workspace .venv/venv; PATH fallback prefers python3 on macOS and python on Windows. Open Settings → CodeCraft → Python Intelligence to disable semantic completion or provide absolute interpreter and language-server paths. The status bar reports Starting, Ready, or Unavailable; an unavailable server never disables normal editing or saving.

Semantic completion opens automatically while typing, including after member-access dots such as service.. CodeCraft does not bind macOS Option combinations because they may produce composed input characters. Ctrl+Space remains available where the operating system does not reserve it.

Keyboard shortcuts

macOSWindowsAction
Cmd+SCtrl+SSave the current file
Cmd+FCtrl+FSearch within the file
Cmd+/Ctrl+/Toggle line comments
Cmd+Z / Cmd+Shift+ZCtrl+Z / Ctrl+YUndo / redo
Tab / Shift+TabTab / Shift+TabIndent / outdent
—Ctrl+SpaceOpen completion manually

Documentation

Limitations

  • CodeCraft supports UTF-8 source and text files up to 2 MiB.
  • Symbolic links are read-only.
  • Python hover, signature help, diagnostics, automatic cross-file edits, and go-to-definition are not included yet.
  • Linux has not been validated and is not currently supported.
  • There is no cross-window draft synchronization.

License

MIT. See LICENSE.

Related plugins