refactor(CommitLog): 移除 CHANGES 视图,整合提交/日志能力并新增目录树切换与提交悬浮详情; - #47
Merged
ThreeFish-AI merged 1 commit intoJul 3, 2026
Merged
Conversation
- 视图整合:删除 CHANGES 树(changes-tree.ts),文件列表/单文件右键菜单/changelist 切换与管理/标题栏 Git 操作/未提交角标全量平移入 Commit webview;commands.ts 命令实参统一为 ChangeItem|path,由 resolveChange 回落 service.getChanges() 解析(单一事实源);package.json 视图与菜单迁移至 view==hyperGit.commit,移除 hyperGit.changes。 - 目录树切换:新增 engine/tree/file-tree.ts(compact 折叠、目录优先+数字感知稳定排序、叶子 fileIndex 回指扁平 files[]),Commit 与 Log 文件列表支持平铺↔树形切换,切换/折叠零 host 往返,偏好按视图各自记忆;新增 file-tree.test.ts(15 用例)。 - 提交悬浮详情:Log 行悬停展示本地/远程分支、标签、HEAD、完整消息(subject+body)、作者、(异于作者时的)提交者、绝对+相对时间、完整 SHA;LOG_GRAPH_FORMAT 扩展 %cn/%cI/%b(%b 置末字段,RS/NUL 边界),host 侧 capBody 截断控 1000 行 payload;与 CI 浮层互斥,滚动/重绘自动消隐,i 键开 Esc 关。 - 评审修复:提交浮层 mouseleave 复位 overCtRow,避免「行→浮层→空白」后浮层卡死;capBody 改用 Array.from 按码点截断,避免劈开 Unicode 代理对产生孤立代理位。 - 文档:新增三份特性文档(commit-view-consolidation / file-list-group-by-directory / log-commit-tooltip),更新 CHANGELOG、issue、knowledge-map。 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
This was referenced Jul 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.
背景
Commit 视图顶部「Active Changelist」与独立的 CHANGES 树视图展示同一份数据(同源
service.getChanges()+registry.getGroups()),属冗余。本 PR 移除 CHANGES 视图并将其全部独有能力零回归平移入 Commit webview,同时为 Commit / Log 两个视图的文件列表补齐「按目录分组」形态,并为 Log 视图补齐提交悬浮详情。侧边栏视图数由 7 降为 6。主要变更
1. Commit 视图整合(移除 CHANGES,能力全量平移)
changes-tree.ts及hyperGit.changes视图;package.json的view/title、view/item/context菜单迁移至view == hyperGit.commit,去掉与 webview 内 Commit/Commit&Push 按钮重复的两项。<select>+⋯菜单)、活动栏未提交数角标全部迁入 Commit webview。commands.ts文件级命令实参统一为ChangeItem | 路径字符串,host 经resolveChange回落service.getChanges()解析(单一事实源);视图刷新改由registry/service.onDidChange → refreshAll → commitView.refresh()驱动。postMessage→ hostshowQuickPick→ 复用既有命令」范式,键盘可达、无 CSP/焦点陷阱、零 in-DOM 浮层成本。2. 变更文件目录树切换(Group By Directory)
engine/tree/file-tree.ts:/分段建 trie,目录在前、文件在后,数字感知升序稳定排序,compact 折叠单目录子链(对齐 VS Codeexplorer.compactFolders默认行为);叶子以fileIndex回指扁平files[](单一事实源,不复制条目数据)。graph-layout「host 算树、webview 渲染」范式:树随 payload 同批下发,切换/折叠零 host 往返;Commit 视图目录三态级联 + Select All 联动,Log 视图为只读浏览;偏好按视图各自setState记忆。新增tests/unit/file-tree.test.ts(15 用例)。3. Log 提交悬浮详情(Commit Tooltip)
name <email>)、(异于作者时的)提交者、绝对 + 相对时间、完整 SHA;悬停零往返(数据随首帧图下发)。LOG_GRAPH_FORMAT扩展%cn %cI %b(%b置末字段,记录以 RS%x1e终止、字段以 NUL%x00分隔,二者不出现于 git 文本,故正文内换行/管道/反斜杠不被误判为边界);host 侧capBody截断至上限以控 1000 行 payload。#rows之外(虚拟滚动重写不销毁),与 CI 浮层互斥,滚动/刷新/重绘自动消隐;i键打开、Esc关闭;所有外部内容经esc()转义(XSS 安全)。4. 代码评审修复
mouseleave复位overCtRow,避免「行→浮层→空白」后scheduleHideCommit的!overCtRow && !overCt守卫失效致浮层卡死。capBody改用Array.from按码点截断,避免 2000 边界劈开 Unicode 代理对产生孤立代理位(渲染为�)。验证
pnpm run check-types && pnpm run lint && pnpm run test:unit全绿(32 文件 / 324 用例);Extension Development Host(F5)实测三视图交互正常:无 CHANGES 视图、Commit 顶部可切换/管理 changelist、两视图 List/Tree 即时切换、提交悬浮层含引用组+完整消息+作者/提交者/时间、CI 与提交浮层互斥、活动栏角标随未提交数增减。