dsh-web-search-ddg
aooyoo
Zero-token DuckDuckGo search provider for the DeepSeek Harness (DSH) web seam — local headless browser, no API key, no m…
wolfsonliu/dsh-file-explorer-preview-code
DSH Web file-explorer preview plugin: code preview & editor for DSH Web — per-language syntax highlighting, in-place editing with autosave, and dark/light themes. Overrides dsh-file-explorer's plain-text preview. | DSH Web 文件浏览器插件: 代码预览与编辑插件——按语言语法高亮、就地编辑自动保存、深色/浅色主题,覆盖 dsh-file-explorer 的纯文本预览。
PROJECT TOPICS
PROJECT README
中文 | English
A CodeMirror 6 code preview and editor for DSH Web, built on codemirror (basicSetup) + @codemirror/language-data (per-language highlighting) + @codemirror/theme-one-dark (dark theme). It overrides dsh-file-explorer's built-in plain-text preview (priority 0) at priority 10, giving code files syntax highlighting plus in-place editing with autosave.
| Dark theme | Light theme |
|---|---|
![]() |
![]() |
@codemirror/language-data (~90 languages), so .ts/.tsx/.js/.jsx/.json/.css/.html/.py/.yaml/.yml/.toml/.sh/.go/.rs/.java/.c/.cpp/.h/.xml/.sql/.ini each get the right tokens.<pre>.Ctrl/Cmd+S saves immediately.Ln/Col cursor position, and the save state (Unsaved / Saving… / Saved / Save failed) with a manual Save button.data-ds-dark-theme) live.fileExplorer service, so the core file explorer is untouched.This plugin requires @dsh-external/dsh-file-explorer — it injects the fileExplorer cordis service, which provides registerPreview and writeFile (the save path). Install and enable dsh-file-explorer before this plugin:
git clone https://github.com/wolfsonliu/dsh-file-explorer.git
cd dsh-file-explorer
npm install && npm run build
dsh plugin --profile web add .
@dsh-external/dsh-file-exploreris installed from git (github:wolfsonliu/dsh-file-explorer) sotscresolves its./clienttype definitions. To develop against an unpublished local checkout instead, point that dependency at your own path.
From the git repository:
git clone https://github.com/wolfsonliu/dsh-file-explorer-preview-code.git
cd dsh-file-explorer-preview-code
npm install && npm run build
dsh plugin --profile web add .
dsh web
The client entry injects fileExplorer and locale, then registers one CodePreview component for every code extension at priority 10:
export const inject = ['fileExplorer', 'locale']
export function apply(ctx) {
ctx.effect(() => {
const component = makeCodePreview(ctx.fileExplorer.writeFile, ctx.locale.bind(CODE_NS))
const disposers = CODE_EXTS.map(ext => ctx.fileExplorer.registerPreview(ext, component, 10))
return () => { for (const d of disposers) d() }
})
}
Registered extensions (CODE_EXTS): ts tsx js jsx json css html py yaml yml toml env sh go rs java c cpp h xml sql graphql cfg ini.
The editor component only ever receives preview.kind === 'text' (the core routes empty / binary / too-large / image to its own previews first). Edits flow back through fileExplorer.writeFile(filePath, content).
The bundle inserts a single roster row (no host-side configuration):
- insert:
- id: file-explorer-preview-code
name: '@dsh-external/dsh-file-explorer-preview-code'
@codemirror/language-data matches 21 of the 24 extensions to a language. env and graphql have no language support and open as a plain (un-highlighted) editable buffer; cfg matches language-data's legacy TTCN_CFG (a matching artifact, not a semantic ini match). All still open in the editor.
@codemirror/* language packages are inlined into a single lib/client.js (~2.7 MB raw, loaded lazily on demand)..md/.mdx stay with dsh-file-explorer's built-in markdown preview.maxTextBytes are already rejected by the core before reaching this plugin.This repo is the reference implementation for building a preview plugin. See docs/developing-preview-plugins.md (中文) for the contract, a minimal skeleton, bundling notes, and i18n.
.cif/.pdb, built on the same fileExplorer contract.npm install
npm run check # tsc type check
npm test # vitest unit tests
npm run build # tsc + tsdown (host ESM stub + client CJS bundle)
After
npm run build, hard-refresh the browser (Ctrl/Cmd+Shift+R):dsh webmay keep serving a cached plugin bundle, so a soft reload can leave your latest build unused.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。