Web 客户端悬浮文件预览窗:懒加载文件树、CodeMirror 预览与窗内编辑保存、Markdown 与图片预览、Quick Open 搜索,以及点击会话中的路径直接打开。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:UndeadSheep/dsh-file-preview#path:/packages/dsh-file-preview
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本。请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Workspace file-preview host half: a Typert Remote (filePreview) that lists the
workspace tree, reads/writes text files, and resolves the preview theme and config for
the browser half.
The browser UI lives in a separate package:
@undeadsheep/dsh-client-ui-file-preview.
Remote surface
| Method | Request | Result |
|---|---|---|
listDir |
{ sessionId, path } |
Ok<FileTreeNode[]> | Rejected |
readFile |
{ sessionId, path } |
Ok<{ path, content }> | Rejected |
readImage |
{ sessionId, path } |
Ok<{ path, mimeType, data }> | Rejected |
writeFile |
{ sessionId, path, content } |
Ok<{ path }> | Rejected |
readTheme |
{ sessionId } |
Ok<{ colors, bg, fg }> |
readConfig |
{ sessionId } |
Ok<{ indentSize, useTabs, pollInterval, fontSize }> |
Business results use the repo's { ok: true, value } | { ok: false, error: { code, ... } }
convention; the generated ./remote face wraps them in the RemoteResult carrier.
Wire codecs are generated from the @Remote method types by typert codegen — there is
no hand-written schema file.
listDir lists a single directory (path = '' for the workspace root) and skips
heavy/noise directories (node_modules, .git, .next, …); dir nodes carry empty
children, which the browser half fills lazily by calling listDir again when a
directory is expanded.
Config
| Key | Default | Meaning |
|---|---|---|
maxFileBytes |
2097152 | Maximum UTF-8 byte length the preview will read |
maxImageBytes |
5242880 | Maximum byte length of an inline image the preview will read |
Workspace config files (read per Session, optional)
preview.config.json—indentSize,useTabs,pollInterval,fontSize(with.prettierrc/package.json#prettierfallback for indent knobs)preview-theme.json—keyword,string,number,comment,tag,function,type,variable,background,foreground.vscode/settings.json—editor.tokenColorCustomizationsandworkbench.colorCustomizationsare read as a fallback theme
Known limitations
- Preview is text-only; binary or oversized files return
not-text/too-large. - Syntax highlighting is a lightweight hand-written tokenizer (not highlight.js / TextMate), and a prettier engine cannot be embedded.
- Auto-refresh is polling (
pollInterval), not a real file watcher.
链接
同类插件
zhu1090093659/dsh-web-ui#packages/dsh-web-ui-all★ 4430
DSH Web UI 插件与皮肤合集:任务看板、git 图、右侧面板、远程移动端 UI、桌宠、实时 token 统计与皮肤中心。
omdsh-dev/DSH-better-sidebar★ 2101
侧边栏完整工作台:内置文件渲染编辑、终端、Git 与子代理,支持三方插件注册新 Tab。
ccch1mneyyy/dsh-TUI★ 1924
Claude Code 风格全屏终端 UI:像素鲸鱼顶栏、实时工作状态行、思考流式展开。
omdsh-dev/dsh-at-file★ 362
Codex 风格的 `@file` 文件引用,输入框里直接搜索并引用工作区文件。
omdsh-dev/dsh-genui★ 214
助手回复内渲染交互式 UI 组件:布局、图表、表单、测验、mermaid、3D 场景与回传事件循环。
huiliyi37/dsh-tianshu-tui★ 211
DeepSeek Harness 的终端 UI(TUI)。