All plugins

DSH / BUNDLE / CLIENT-UI

dsh-edit-diff

v0.6.0senyayume / dsh-edit-diff56c8708563

InstallableBundlesUI & client pluginsCommunity · Topic auto-analysisWeb UI

Overview

dsh-edit-diff

Redraws line-level diffs on DeepSeek Harness file-mutation tool cards (dedup + inline emphasis), covers run_code (PTC) sub-calls and str_replace_editor, adds a per-turn changed-files card, and reveals any of those paths in the OS file manager through the plugin's own host route.

README / EN

Package documentation

Registry summary

Redraws line-level diffs on DeepSeek Harness file-mutation tool cards (dedup + inline emphasis), covers run_code (PTC) sub-calls and str_replace_editor, adds a per-turn changed-files card, and reveals any of those paths in the OS file manager through the plugin's own host route.

dsh.pub verifies the pinned bundle contract, runtime facts, and distribution semantics. The complete README remains in the source repository.

Read the full README on GitHub

LIMITATIONS

Known limitations

- **语法着色**:已做(见上面「语法着色与背景高亮」一节),但走的是**插件自带的近似分词器**—— primitives 不导出它的高亮器,而复用它需要改 DSH 核心,已排除。配色仍与内置代码块同一套 `--shiki-token-*` 变量。剩下的限制都写在那一节里。**「自写分词器 vs 自带 shiki」这条路线 已经定过,别再翻案**:理由与两条路的实测代价见那一节的「路线选择」。 - **真实文件行号**:**已做,两级**。 ① **主路(精确)**——host 半身包住借用来的 `edit`/`write` 定义上的 `output.presentationMeta`, 在它返回的 `meta.diffs` 上打 `oldStart`/`newStart`:基准是这次执行自己的 `before`/`after` 原文, 也正是 hunk 的来源,所以在原文里**单调定位**后像就得到精确行号,不读文件、不怕文件漂移。任一**有内容** 的一侧定位不到就两侧都不打戳(混合的半对号比没有更坏),包装全程 try/catch 且卸载还原。 ② **fallback(best-effort)**——结果块**没有** `meta` 的 hunk(PTC 子调用、安装前写下的历史)由客户端 经 `/edit-diff/read` 读**当前**文件、按唯一性定位后像(重复出现就拒绝,不锚第一个)。 **同一次读还带回片段前后各 3 行真实上下文**(`CONTEXT_LINES`),让裸片段不再像凭空两行: 那几行是文件自己的行,所以行号列显示的是**真实行号**,并按 hunk 的同一份 `indent` 一起去缩进, 底色与改动标记照旧;它们与 hunk 的行一起送进分词器,所以跨行字符串的状态是连着的。 上下文**只给参数推导的 hunk**:metadata hunk 自带 `structuredPatch` 的三行上下文,再补一份就是六行; 也**只给新侧有锚**的片段——那些行要按锚换算行号,没有锚就只能退回相对编号,正是锚要消除的歧义。 两条都拿不到基准的行退回**窗口内相对编号**,只靠**更暗的一档字色**区分。 **不要**给它加标记字形:`~` 是低矮波浪线,在 10px 下会和行首 CSS 画的 `- `/`+ ` 标记糊在一起; `?` 更看不清——两个都试过,都比不加更糟。代价(纯颜色区分对色觉障碍读者无效)是**已知并接受**的。 客户端按侧读基准:删除行读旧侧、新增与上下文行读新侧(上下文行在文件**现在**的位置上)。 - **撤销/恢复**:要 host 端快照台账加写回校验,ZCode Desktop 那张卡靠的就是同一类 host 契约 (checkpoint + `previewFileRewind`/`applyFileRewind`)。本插件的轮末卡只做汇总、折叠、展开与 「打开」文件——凭客户端插件自己实现不了可信撤销,所以没接。 - **给内置侧边栏的工作区/会话行加菜单项**:`dsh-client-ui-workspace` 给项目行的 `Menu` 只喂了 `rename` / `delete` 两行(源码注释:"Menu can emit only the rename and delete rows supplied above"), 而侧边栏对外只有面板级槽位(`sidebar` / `sidebar.workspaces` + 它的 `sidebar.workspaces.directoryFlow`), 没有「行级菜单项」槽位。要加只能改 shipped bundle(`<DSH 安装目录>/resources/app/node_modules`)—— DSH 一升级就丢,且属于改核心,不做。 - **窗口化渲染**:对齐后行数通常很少,长 hunk 由 `max-height:320px` 的滚动容器兜住(行全部进 DOM, 实测 1200 行退化 hunk 不卡);真正的虚拟滚动没做。