dsh-at-file
FSMargoo/dsh-at-fileCodex 风格的 `@file` 文件引用,输入框里直接搜索并引用工作区文件。
dock 系列文本查看与编辑器:支持撤销重做、Ctrl+S 保存、未保存确认和二进制检测,作为 dock-files 的默认文本查看器。
The best text editing plugin in the DSH ecosystem — no contest. Reading code, tweaking configs or writing docs in DSH? dock-editor is the default answer: undo/redo, Ctrl+S save, unsaved-change confirmation, binary detection and floating-window geometry memory — all of it. Other viewers just display; dock-editor lets you actually change things.
Text viewer/editor plugin of the dock family: registers the editor file viewer (the default one) and the matching editor-area view; reads and writes file text through its own /desk-editor host route.
--dsw-alias-* variables.Ctrl+F opens an in-editor search widget in the top-right, Ctrl+H with replace, F3/Ctrl+G (shift to reverse) walks matches, Esc closes. The widget is a separate overlay (not a CM showPanel), so it reserves no editor layout — no drag-select auto-scroll, no misplaced match, no replace-row collapse. Live match highlighting + a current/total counter, ↑/↓ previous/next, Enter next (Shift+Enter previous); replace is collapsed by default (expand via ⇄), it follows the DSH theme (light and dark), and wheeling over it scrolls the editor rather than the page.Ctrl+S save (global while the view is on screen); Ctrl+Z undo / Ctrl+Y(or Ctrl+Shift+Z) redo, Ctrl+C/V/X/A copy/paste/select-all, all via the editor's native keymap; plus Alt+↑/↓ move line and Ctrl+/ comment.beforeClose hook and the seed dirty flag).Code-editor overhead:
CodeMirror 6is a build-time devDependency bundled intolib/client.js(same rule as dock-markdown bundling marked; it is not a runtime dependency). The client bundle is about 1.12 MB (gzip ≈ 300 KB) — dominated by the editor runtime (@codemirror/viewetc.), with all language grammars adding only ≈68 KB (gzip).
| Dependency | Type | Notes |
|---|---|---|
| dock >= 0.1.0 | peer (required) | workbench shell: the editor-area view, floating windows and ctx.workbench come from it |
| dock-files >= 0.1.0 | peer (required) | file-domain service: dock-editor is dispatched as its editor default viewer |
| DSH Web environment | runtime | required; client platform is Web |
cordis ^4.0.0-rc.7 | peer | plugin framework (ships with DSH) |
react ^18.2.0 | peer (optional) | needed for client rendering; without it the editor UI does not activate |
@codemirror/*, @lezer/highlight | dev (build-time) | CodeMirror 6 editor + language grammars, compiled into lib/client.js; not needed after publish |
Optional companions: more viewers such as dock-images and dock-markdown can coexist with dock-editor, each taking over its own extensions (dock-editor remains the default fallback viewer).
Requires dock and dock-files:
Recommended install from the npm registry:
dsh plugin --profile web add dock-base
dsh plugin --profile web add dock-files
dsh plugin --profile web add dock-editor
Or install from GitHub (alternative):
dsh plugin --profile web add github:AKS1st/dock
dsh plugin --profile web add github:AKS1st/dock-files
dsh plugin --profile web add github:AKS1st/dock-editor
The /desk-editor route only accepts POSTs from trusted origins (loopback / trustedHosts plus same-origin check). Read paths only need to be absolute — they are not confined to the session workspace, because the conversation context can mention files outside it (e.g. ~/.dsh/skills/...) and the viewers open them for viewing; writes remain confined to the session workspace (403 otherwise), and outside-workspace files open read-only in the editor; writes also verify the target size does not exceed the read cap.
MIT