feat(macos): 对齐 IDEA 的分支弹窗交互模式 - #392
Conversation
The branch popup checked out a reference on a plain click, so scanning the list could switch the working tree by accident; checkout was otherwise only reachable through the right-click menu. Branch rows now present their actions through a native pop-up menu, with Checkout as one explicit entry. The native menu also supplies IDEA's hover-safety path: once a row's menu is open, moving to another row opens that menu without a click. Rows whose branch or upstream name the fixed popup width truncates expose the full pair as a hover tooltip.
The testing helper detaches into its own process group, so the previous group-scoped walk only sampled the shell wrapper waiting on its child. Walk the ppid tree instead and capture a listing plus a thread-stack sample of every descendant before terminating the run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@xiaoyumuxi 更正一下上一条 Review:我把 PR #392 从 base 到 head 的整体 diff 与本次功能提交混在了一起,错误地将 Swift test watchdog 的问题作为本 PR 的阻塞问题。 经重新核对提交归属:分支弹窗功能提交是 保留的范围判断是:这些 CI 提交确实出现在当前 PR 的整体 diff 中,最好通过正确的 base/rebase 或单独 PR 管理,避免功能改动与基础设施改动耦合;但这属于提交组织建议,不应据此阻塞分支弹窗功能本身。 按你的实际功能提交重新判断,目前未发现需要阻塞合并的分支弹窗代码问题。剩余验证缺口主要是 macOS 原生 Menu 的相邻行 hover 切换、长名称 tooltip,以及完整 macOS 构建/行为测试的实际运行验证。分支行改为显式 action menu、删除操作接入确认流程,以及新增的行为契约测试仍然值得保留。 |
那一部分是你们之前合入的,但是我迁出分支的时候还没有这个改动,为了CI过掉,我直接去将你们合入的改动拉上来了因此才会出现这种耦合的样子 |
|
这个pr没啥问题了 解决一下冲突就可以合了 |

背景
当前分支弹窗存在两个问题:
origin/codex/res…)被截断后无法在悬停时查看全名。改动
macos/Sources/Lithe/Views/Git/BranchSwitcherPopover.swiftbranchRow从直接 checkout 的Button改成BranchActionMenuRow,使用SwiftUI.Menu+.menuStyle(.borderlessButton),左键打开 native NSMenu。Checkout(仅非当前分支),再是 Update / Push…,最后是 Delete(本地且非当前分支)。dismissAndRun在执行操作前先关闭弹窗,防止操作触发的 sheet 出现在即将消失的 popover 后面。.help(branchRowTooltip(_:))在悬停时展示完整的branch → upstream名称对,解决截断问题。macos/Tests/LitheTests/BranchSwitcherPopoverBehaviorTests.swift(新增)三个源码契约测试,锁定关键行为:分支行必须通过
BranchActionMenuRow呈现、model.checkoutReference只能有一个调用点且必须挂在Checkout菜单项下的dismissAndRun里、hover tooltip 必须存在。验证
swift build --target Lithe— 通过./scripts/verify-service-boundaries.sh— 通过swift test --filter BranchSwitcherPopoverBehaviorTests— 3/3 通过改动仅限 Views 层,未涉及 model、service 或 contract。合并前建议手动确认:hover 到相邻行时菜单是否无延迟切换、tooltip 是否在长名称行上正常显示。