Skip to content

feat(UI): Commit 标题栏 Default 副标题隐藏与「…」菜单批量 Discard Changes; - #121

Merged
ThreeFish-AI merged 10 commits into
feature/1.x.xfrom
ThreeFish-AI/commit-view-toolbar-ui
Sep 10, 2026
Merged

feat(UI): Commit 标题栏 Default 副标题隐藏与「…」菜单批量 Discard Changes;#121
ThreeFish-AI merged 10 commits into
feature/1.x.xfrom
ThreeFish-AI/commit-view-toolbar-ui

Conversation

@ThreeFish-AI

@ThreeFish-AI ThreeFish-AI commented Sep 10, 2026

Copy link
Copy Markdown
Owner

概述

承接 #120(Commit 视图头部两行 UI 上移标题栏)的增量演进:Commit 视图 a11y 修复、标题栏布局演进与批量 Discard 能力、Branches 视图标题栏重排与 per-branch Push。check-types / lint / test:unit(45 文件 426 用例)全绿。

变更内容

1. A11y 修复:Commit 文件列表树语义回归可聚焦容器

  • role="tree"aria-label="Changed files" 保留于 #filestabindex=0 键盘焦点容器),读屏聚焦时恢复树语义播报;
  • 吸顶 Select All 行与行区容器降为 role="presentation",桥接中间结构层、不破坏 tree 子项语义。

2. Commit 视图:Default 副标题隐藏 + Discard Changes + 布局重排

标题栏布局(navigation 组,从左到右)

位置 控件
最左 $(discard) Discard Changesnavigation@0.5,本次新增)
其后 $(list-tree) / $(list-flat) List ⇄ Tree 互斥切换(navigation@0.75
后续 $(refresh) Refresh(navigation@1)、$(arrow-up) Push(navigation@5

「…」菜单0_changelist 组(Set Active Changelist… 切换/管理 QuickPick、New Changelist…,居同步组之前)→ 1_sync 组(Pull / Fetch / Push Dialog / Update Project / Create·Apply Patch)。

  • view.description 仅在非默认 changelist 活动时显示列表名,Default 省略(无信息量不常驻);
  • 批量 Discard 数据链路:勾选集仍以 webview 为事实源,四个勾选变更点(单文件勾选 / 目录级联 / Select All / state 调和)经新增 commit/checkedChanged 消息单向同步 host 镜像(切仓库置空待重推,失效路径由 resolveChange 兜底过滤);
  • 执行:复用泛化后的 hyperGit.discardChanges(单文件右键与批量统一路径)——单次 modal 确认,批量时 detail 列示目标文件(超 10 个截断);未跟踪 clean 删除、已跟踪 restore 还原各一次批量调用;无勾选时信息提示、不弹确认框。

3. Branches 视图:标题栏重排 + 分支右键 Push

标题栏布局(navigation 组,从左到右)$(refresh) Refresh → $(add) New Branch… → $(arrow-down) Pull → $(clear-all) Prune Deleted Remote Branches(navigation@4,即原 Push 图标位) → 分组切换互斥图标。

「…」菜单:Fetch → Update Project… → Merge…(收入折叠,不再占图标位) → New Tag…。

分支右键新增 Push(hyperGit.pushBranch:右键任一本地分支即可推送该分支——已配置上游时按显式 refspec 推送到追踪分支(本地名/上游名不一致亦正确;上游取自 %(upstream:short),非当前分支无 HEAD.upstream 可用),无上游时选定 remote 并以 -u 建立追踪(双路径语义同全局 Push);palette 不泄漏(右键 only)。

图标常驻提示:视图头部图标默认 hover/聚焦才显示为 VS Code 平台行为,开启 workbench.view.alwaysShowHeaderActions 即可常驻(已记入 CHANGELOG)。

验证

  • pnpm run check-types && pnpm run lint && pnpm run test:unit 全绿(45 文件 426 用例;commit-titlebar / branches-titlebar 双护栏覆盖命令定义、navigation/ 菜单/右键菜单槽位与 palette 门控,冒烟列表同步更新);
  • CHANGELOG 与 commit-view-consolidation.md 已同步。

🤖 Generated with Claude Code

- Active Changelist 下拉与 ⋯ 管理菜单合并为标题栏 \$(checklist) 图标(Refresh 左侧)→ setActiveChangelist QuickPick:各列表带文件计数、活动项预选,分隔线后并入 New/Rename/Delete(默认列表不可改名删除);活动列表名常驻 view.description 副标题;
- 文件列表 List ⇄ Tree 段控改为标题栏 \$(list-tree)/\$(list-flat) 互斥图标(context key hyperGit.commit.tree,交互同 Graph/Branches 范式),偏好移交 host workspaceState 按仓库持久化(hyperGit.commit.dmode:<repo>),旧 webview state 偏好一次性重置为默认 flat;
- Select All 复选框吸顶于文件列表容器内首行(空态随空列表隐藏),原 .cl-bar 与 files-header 两行整体移除,净省两行纵向空间;
- 协议收缩:删 commit/setActive、commit/changelistMenu 消息与 CommitChangelistItem,state 增 mode 字段(host 为事实源整态下发);清理死图标 ICON_ELLIPSIS;
- 新增 tests/unit/commit-titlebar.test.ts 清单护栏;CHANGELOG 与两份特性文档同步。

🤖 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>
…/commit-view-toolbar-ui

# Conflicts:
#	CHANGELOG.md
…顶 Select All 行与行区容器降为 presentation;

🤖 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>
…ew 单向镜像 host,discardChanges 单/多统一路径;

🤖 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>
…tive Changelist… 与 New Changelist… 收入「…」菜单 0_changelist 组;

🤖 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>
…e 上移 navigation@4,Merge… 收入「…」菜单;

🤖 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>
…compare),补图标名白名单护栏与标题栏图标常驻命令入口;

🤖 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>
…实源并同步清理索引死链;

🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant