Repository navigation
feat(sidebar): 划选的引用 chip 可点击 —— 跳回源文件并闪行段 - #1111
Merged
Merged
Conversation
- 移植到 dev 基线(omdsh-dev#1052 / omdsh-dev#1002 之上):只加「可点击 + 行段落地」,不重做 chip 本体 - 自有 input-trigger source `betterSidebarQuote`:`openReference` 校验会话后回跳, `codec.serialize` 在发送时还原成与升级前字节一致的 `路径:起止` + 围栏正文 - 行段末行走模块级一次性旁路 `src/client/line-target.ts`(key = path + line,cap 32), 不写进宿主导航参数(宿主 `SidebarRightResourceParamsMap.file` 只声明了 `line`) - 引用记录存 `localStorage`(`dsh-better-sidebar:quote-refs`,FIFO 200):模块同时进 core bundle 与 lazy editor chunk,两个实例只能靠它互见;插入失败即回滚记录 - 行段闪光用 CodeMirror 行装饰 + 皮肤令牌 `--dsw-alias-interactive-bg-hover-accent` - 三级降级:自有 chip → omdsh-dev#1052 内置 chip → 纯文本,永不比升级前更差 - 新增 peer `@deepseek-ai/dsh-client-ui-input-trigger` `^0.2.1-rc.1`(DSH peer 增至 14 条) - 文档:指南新增 §7.2,并补 `openFile` options / `FileViewerProps.lineEnd` / peer 说明; AGENTS §3、CHANGELOG 双语、README 双语、`docs/plans/2026-11-03-selection-quote-chip.md` - 测试:`selection-quote` 23、`quote-flash` 13、`line-target` 7,`conversation-draft` +2
Menghuan1918
added a commit
that referenced
this pull request
Nov 4, 2026
…失败回退、注册契约与文档) # Conflicts: # CHANGELOG.md # CHANGELOG_EN.md
Menghuan1918
added a commit
that referenced
this pull request
Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
在 #1052 的引用 chip 之上,补上 #888 要的后半程:划选出来的那枚 chip 变成可点击的,点它跳回源文件并闪烁被引行段。
code/markdown/jsonl编辑面与 Markdown 预览里划选 → chip 归属插件自有 input-trigger source → 点击回跳(定位 + 行段闪光 2.4 s)→ 发送时展开成与升级前字节一致的路径:起止+ 围栏正文。insertDraftReference只多两个可选字段(source/ref),默认值不变,现有调用方载荷字节不变。为什么是这个切法
#888 的两半在
dev上状态不同:#1052(25fd296)已经落了「紧凑 chip + 发送时展开」,#1002(f74369d)修掉了整框重写拍平已有 chip;但 chip 的source恒为'reference',宿主按这个名字找不到任何openReference处理者,所以点击是惰性的。本次只补「谁响应这次点击」,不重做 chip。实现
src/client/selection-quote.ts用ctx.inputTriggers.registerSource({ trigger: '@', name: 'betterSidebarQuote', candidates, onPick, openReference, codec })。宿主按ref.source === name路由点击与发送序列化;没有 codec 的 source 宿主会拒发而不是静默降级,所以注册永远先于插入(commit 时自愈重试一次,already registered视为就绪)。openReference:校验 chip 的会话 →ctx.betterSidebar.openFile(scope, path, undefined, { line, lineEnd })。换了会话不跳(cwd 可能不同,会打开错文件)。codec.serialize:复用buildSelectionInsert,发送出去的东西和 feat(editor): 「添加到对话」改用引用 chip,正文只在发送时展开 #1052 完全一致(<相对路径>[:起[-止]]+ ≤500 字符围栏正文)。src/client/line-target.ts——模块级一次性旁路(key =path#line,cap 32,取出即删)。宿主SidebarRightResourceParamsMap.file只声明了line,多塞键属于未声明契约(「nothing validates them at run time」),今天能过、明天可能被裁掉且不报错。localStorage(dsh-better-sidebar:quote-refs,FIFO 200):该模块同时进 core bundle 与 lazyeditorchunk,两个实例只能靠它互见记录。插入失败即回滚记录,不留孤儿 id。src/client/quote-flash.ts用 CodeMirror 行装饰(StateField+mapPos跟随编辑),颜色color-mix(in srgb, var(--dsw-alias-interactive-bg-hover-accent) …),零硬编码颜色,prefers-reduced-motion下减弱。降级链
ctx.inputTriggers/ 注册被拒plain/claimed、draftRev不匹配appendToDraft纯文本任何一级都不比升级前更差。
已知边界
line,跳转与闪光只在右侧栏生效(那里 chip 仍能点开文件)。pnpm test:mount)不覆盖「点 chip → 打开 + 闪光」,需手工点一次。测试
tests/selection-quote.spec.ts(23)、tests/quote-flash.spec.ts(13)、tests/line-target.spec.ts(7)、tests/conversation-draft.spec.ts+2。tests/git.spec.ts:510(本机 git 2.34.1 不支持checkout --end-of-options),src/git.ts与tests/git.spec.ts本次零改动,scratch 仓库可独立复现。tsc --noEmit绿、eslint改动文件零输出、build成功(lib/client.js与lib/client-editor.js均含新模块)、npm pack --dry-run491 files / 5.6 MB。文档
docs/external-plugin-guide.md:新增 §7.2(source 注册 / codec 的拒发语义 / 三级降级 /lineEnd旁路),补openFile的options、FileViewerProps.lineEnd、§2.2 的 peer 说明。AGENTS.md§3:DSH peer 增至 14 条(新增@deepseek-ai/dsh-client-ui-input-trigger,^0.2.1-rc.1)。CHANGELOG.md/CHANGELOG_EN.md(未发布)、README.md/README_ZH.md双语一句、docs/plans/2026-11-03-selection-quote-chip.md设计记录。发版
合并进
dev后按新功能走 minor:chore(release): v0.30.0。