English | 简体中文
@zhangzhian/dsh-devtools-files
dsh-devtools 的文件组件:右侧边栏的文件树,加上对话内容区里遵循 VSCode
预览编辑器语义的文件页签。
安装
dsh plugin add @zhangzhian/dsh-devtools
@zhangzhian/dsh-devtools 是清单包,装它会带齐所有组件(包括这个)。只想用文件
组件的话:
dsh plugin add @zhangzhian/dsh-devtools-files
提供什么
- 文件树 —— 工作区目录树,带 Git 状态点、搜索、新建文件/目录、重命名、 删除、上传、下载。
- 预览标签 —— 单击用预览标签打开(标题斜体),再点别的文件就替换它; 双击固定为新页签;在预览标签里一编辑就自动固定。空白会话(内容区还没有页签条) 时改走平台官方的资源导航,在右栏新开一个页签 —— 不盖住文件树。
- 编辑器 —— CodeMirror 6,约 40 种语言的语法高亮、软换行、
Mod-S保存, 并且带版本守卫:并发改动会弹冲突对话框,而不是静默覆盖。 - 预览 —— Markdown 走平台自己的渲染器(所以和 AI 回复的排版完全一致; 右上角那颗「大纲」按钮可以展开浮动目录,展开时正文让位、不会被压住)、 HTML 走沙箱 iframe,另有图片、音频、视频、PDF,以及超大文件的分页查看。
- 表格与 Office ——
.xlsx/.xlsm用官方同款栈在浏览器里解析和渲染 (ExcelJS 解析 + FortuneSheet 画格子:选区、复制、公式栏、工作表标签、冻结都 是组件自带的行为),不经过 Office 转换;.docx/.pptx/.ppt/.doc/.xls由平台本机的 LibreOffice 转成 PDF 后在内容区预览。表格的两个库放在懒加载分块里, 第一次打开表格才下载。两种都开在中间的内容区,不是右栏。
要求
- DSH
0.2.0-rc.2或更新。 - 没有别的依赖。Git 状态点只在同时装了
@zhangzhian/dsh-devtools-git时出现。 - 表格预览依赖
@fortune-sheet/[email protected]+[email protected](和官方预览同版本)。 FortuneSheet 带一个只读补丁(patches/@[email protected],修allowEdit:false时公式栏的无限setContext),pnpm install会自动应用; 升级这个依赖时 pnpm 会提示补丁需要 rebase。
English
@zhangzhian/dsh-devtools-files
The file component of dsh-devtools: a file tree in the right sidebar, plus
file tabs in the conversation area that follow VSCode's preview editor
semantics.
Install
dsh plugin add @zhangzhian/dsh-devtools
@zhangzhian/dsh-devtools is the manifest package; installing it pulls in every
component, including this one. To use only the files component:
dsh plugin add @zhangzhian/dsh-devtools-files
What it provides
- File tree — the workspace tree with Git status dots, search, new file/folder, rename, delete, upload, and download.
- Preview tabs — a single click opens a file in a preview tab (italic title); clicking another file replaces it. A double click pins it as a permanent tab, and editing a preview tab pins it automatically. In a blank session (no tab strip in the conversation area yet) a click goes through the platform's own resource navigation instead and opens a right-sidebar tab, so the file tree is never covered.
- Editor — CodeMirror 6 with syntax highlighting for ~40 languages, soft
wrap,
Mod-Sto save, and a version guard so concurrent edits raise a conflict dialog instead of silently overwriting. - Previews — Markdown rendered with the platform's own renderer (so it matches assistant replies exactly; the "大纲" button in the corner opens a floating outline, and the text reflows rather than being covered), HTML in a sandboxed iframe, images, audio, video, PDF, and paged viewing for files too large to edit.
- Spreadsheets and Office —
.xlsx/.xlsmuse the same stack as the official preview in the browser (ExcelJS parses, FortuneSheet paints the grid: selection, copy, formula bar, worksheet tabs and frozen panes come from the component itself) with no Office conversion involved;.docx/.pptx/.ppt/.doc/.xlsare converted to PDF by the host's local LibreOffice and shown in the content area. The two spreadsheet libraries live in a lazy chunk, downloaded the first time a sheet is opened. Both open in the middle, not in the right sidebar.
Requirements
- DSH
0.2.0-rc.2or newer. - Nothing else. Git status dots appear only when
@zhangzhian/dsh-devtools-gitis also installed. - Spreadsheet preview depends on
@fortune-sheet/[email protected]+[email protected](the same versions as the official preview). FortuneSheet carries a read-only patch (patches/@[email protected], fixing an endlesssetContextfrom the formula bar withallowEdit:false);pnpm installapplies it automatically, and pnpm asks for a rebase when the dependency is upgraded.