Skip to content

修复 IDE 快捷键导入与终端切换 - #1695

Merged
1lck merged 4 commits into
previewfrom
codex/shortcut-import
Nov 4, 2026
Merged

1lck merged 4 commits into
previewfrom
codex/shortcut-import

Conversation

@1lck

@1lck 1lck commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

用户可见改动

  • 修复导入 VS Code 键位后,焦点在终端时无法再次使用 Ctrl+` 关闭终端的问题,同时保留 Ctrl+D、Ctrl+R 等终端输入。
  • 支持从 IDEA 和 VS Code 读取其参考键位与受支持的用户覆盖,补齐文件内查找和替换、查找下一个/上一个、转到行、定义、实现和引用、命令搜索、断点、终端及运行/调试等常用快捷键;VS Code 的 F5 可随调试状态启动或继续。
  • 正确处理 VS Code 的按命令移除规则,避免误删其他命令或用户快捷键;遇到无法安全转换的条件规则、连续按键和扩展键位时保守处理。来源发生变化时拒绝应用过期预览;现有自定义快捷键冲突需用户处理,原始默认键位可安全让位。
  • 将来源识别、受限文件快照和快捷键导入能力纳入通用插件协议,由内置 IDEA/VS Code 插件实现源格式;只读取用户选择的来源,导入可撤销。
  • 官方插件包验证器支持非语言插件的宿主信任策略,校验声明的后台程序,并拒绝缺失程序、未声明的原生代码和越界路径。
  • 导入失败和兼容性警告写入结构化日志,新增事件不记录来源内容或本机路径。实际触发来源变化后已核对日志文件中的事件与脱敏字段;日志窗口的逐项查看尚未完成。

验证

  • 打包 macOS 应用实际导入本机 IDEA 和 VS Code 配置,验证断点、定义、引用、查找、转到行、终端打开/关闭、Ctrl+D,以及 F5 启动和继续调试;验证重启持久化、撤销和来源变化后的保护;变基后的提交版再次导入本机 VS Code 并验证 Ctrl+G,1,433 个包文件运行前后哈希一致;此前验收包还验证了旧版 IDEA 的 Ctrl+F、Ctrl+F8,以及 VS Code 的条件移除不会误删 Command+S。
  • 变基到最新 Git 修复前,macOS 完整测试 4,392 项、调试和导入定向测试 370 项通过;变基后相关 macOS 定向测试 396 项、插件测试和完整 Rust Core 主测试 1,667 项通过。
  • 完整 Rust Core、Swift 桥接、IDEA/VS Code 插件测试通过;在 Windows 测试机上运行快捷键导入和调试决策测试通过。
  • 本地执行与 CI 相同的官方插件包验证,包含未声明程序、缺失程序及越界路径的拒绝检查;Windows Lithe-dev 上原失败的 Git 回归用例通过;其文件名修复已由 修复 Windows CI 中不合法的 Git 测试文件名 #1696 合入目标分支,本 PR 不再重复修改。
  • 插件 Rust、Node.js、Java SDK 的新旧宿主端到端测试通过;i18n、日志、架构边界、资源复用、运行时发行包只读、测试稳定性及功能矩阵检查通过。
  • 已记录三轮对照内存;现有采样脚本未捕获编辑器输入延迟事件,不据此声称输入延迟改善;稳定 RSS 中位数 237,072 → 237,152 KiB,未覆盖终端按键的专项延迟。

依赖与范围

提交后自审

按仓库 lithe-code-review 覆盖导入语义、快捷键冲突、插件信任、受限快照及生命周期、跨平台契约与测试。已修复审查中发现的旧版 IDEA 继承键位遗漏和 VS Code 条件移除误删问题;首轮 CI 的插件包验证器兼容问题已修复并复测;Windows 测试路径问题的上游修复已纳入分支;未发现需要阻塞合并的代码问题。日志窗口逐项查看、其他 IDE 扩展和键盘布局不在本次实机覆盖内。

@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Nov 3, 2026
@1lck
1lck marked this pull request as ready for review November 3, 2026 22:42
@lithe-code-review

lithe-code-review Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Lithe Review

结论: ⚠️ 有建议
范围: preview ← codex/shortcut-import · head: 40d8343

未发现需要阻塞合并的问题。

Findings

  1. [P2] 快照校验应检测原本缺失的来源文件是否被创建
    macos/Sources/Lithe/Platform/MacOS/Plugins/MacKeymapImportSnapshot.swift:164

    • 实际影响:来源已经变化,仍可能通过版本校验并应用旧参考键位。
    • 触发条件:选择器对应文件在捕获时不存在,在等待插件返回期间被创建。构造快照时忽略缺失文件,validate() 和摘要只检查已捕获的 files。
    • 复现步骤:先对没有 keybindings.json 的 VS Code 来源生成预览;应用时让插件在收到空文件列表后暂停,创建包含用户覆盖的 keybindings.json,再返回参考键位。MacPluginBackendSessions.importKeymap 的最终摘要仍为空快照摘要,应用阶段会接受旧结果。
    • 来源:本次引入;新增异步插件流程的快照没有记录和复查缺失输入。
  2. [P2] 将独立插件的解析回归测试接入 CI
    Plugins/mac/Official/EditorKeymapImport/tests/vscode.rs:5

    • 实际影响:本次迁出的来源解析及移除规则测试不会随现有 CI 执行,后续解析回归可以通过检查。
    • 触发条件:运行当前 Core、Swift 或官方插件验证车道。
    • 复现步骤:该插件不属于 rust/Cargo.toml 工作区;Core 测试入口只测试原工作区,Swift 车道执行 Swift 测试,官方插件验证最终只调用 assemble-package.sh 中的 cargo build。这些入口均不执行新增的 tests/{idea,vscode,manifest,session}.rs。
    • 来源:本次引入;原有 Swift 解析测试被删除,新测试放入独立 Cargo 包但没有新增执行入口。
  3. [P3] 更新共享契约中的能力落地状态
    shared/contracts/plugins/v1/README.md:127

    • 实际影响:契约声明与实际宿主能力矛盾,开发者无法准确判断该扩展点是否可用。
    • 触发条件:依据本次新增契约开发或同步公开契约镜像。
    • 复现步骤:此段仍称 macOS 提供方发现、产品导入流程尚未实现,且没有 SDK 支持;head 已接入上述流程、广告该能力,并引用支持它的 SDK。shared/contracts/rust-core-api.md:82 也保留了相同的过时说明。
    • 来源:本次引入。

Scope Check

  • 关联需求:未找到可验证的关联 Issue;按 PR 描述检查。
  • 已完成范围:IDEA/VS Code 插件解析、Core 校验与冲突规划、macOS 来源快照和导入接入、终端切换及 F5 状态决策。
  • 未完成范围:Windows 导入界面明确不在本次范围;不能据共享 Core 测试认定 Windows 产品已支持导入。
  • 能力复用:复用现有插件会话、权限和取消机制;来源格式留在插件,通用校验留在 Core。
  • Findings 均对应本次新增或迁移的路径,属于本次职责范围。

Suggestions

  1. 保存缺失文件及目录选择结果,在最终校验时按相同预算重新检查;新增文件或目录成员变化应使快照失效,并增加可控暂停的回归测试。
  2. 为独立插件注册受影响 CI 测试入口,通过有界计时 harness 执行四组 Rust 测试并生成报告。
  3. 同步修正插件 README、fixture 表格和 Rust Core API 中的状态说明,保留 Windows 尚未实现的准确边界。
  4. PR 上下文没有截图;请补充导入预览及插件权限界面的前后对比。视觉效果尚未验证。

Summary

主要职责划分清晰,快照权限与会话撤销路径有针对性测试。建议补齐来源新增检测、解析测试的持续执行入口及契约状态说明。

Verification

  • 实际检查:固定 731e946...40d8343,聚焦插件解析 → Core 协商与验证 → Swift 快照 → 预览/应用/撤销,以及终端事件、调试决策、信任策略、共享契约和相关测试入口。未读取锁文件和生成文件正文。
  • 已提供结果:PR 自述变基后 macOS 定向 396 项、Rust Core 1,667 项及插件/SDK 测试通过;本次未独立执行或核验这些结果。
  • head 检查快照:i18n、结构化日志、CI 工具等检查成功;多项 Windows 检查仍在运行,所列 Swift/Core 测试为 skipped,不能视为完整测试已通过。
  • 本次未运行任何代码、测试或验证脚本,未访问网络、修改文件或发布评论。
  • 验证缺口:截图、终端按键专项延迟、日志窗口逐项验收,以及运行中 Windows 检查的最终结果。公开 SDK 提交内容未在本次离线审查中核验。

@lithe-code-review

Copy link
Copy Markdown

Lithe 运行验收

版本:fca1944438fcaf4bba52aab9759289ec2bc68a2a;状态:blocked。
本报告独立于代码审查;只报告实际执行的场景,不代表所有问题均已修复。

执行未完成:Review timed out

本次未形成完整验收结果,详见执行原因。
详细步骤和原始证据保存在服务器受限目录(14 天、总计不超过 1 GiB);当前没有公开下载链接。

@1lck
1lck force-pushed the codex/shortcut-import branch from fca1944 to d3e5c93 Compare November 4, 2026 00:56
@lithe-code-review

Copy link
Copy Markdown

Lithe 运行验收

版本:d3e5c93173202294197379696e1017fffbee6d0d;状态:partial。
本报告独立于代码审查;只报告实际执行的场景,不代表所有问题均已修复。

对照:共同祖先 82eb09cdef87ca2a313c28fc0482d574ec9e4946 → PR head;当前目标分支合并适用性:未运行。

  • 条件不足,未验证:Allow the imported terminal toggle through the focused terminal while preserving other plain Control chords. Baseline MacShortcutDetector defers every plain Control chord before matching commands; head makes an exception for the matched toggle-terminal command.
    • Requires macOS, an interactive desktop and exact-revision Lithe applications using isolated application data. Headless Windows cannot exercise AppKit event dispatch, terminal focus or shell input.
  • 条件不足,未验证:Import IDEA/VS Code reference bindings and supported overrides through the shipped provider; preserve removal semantics, source selection, stale-preview protection, persistence and undo. Include the review's initially missing source-file case, which cannot be established by Core-only validation.
    • The production import workflow, source snapshots and persistence adapters are macOS Swift/Darwin code. No macOS runtime, desktop, packaged application or isolated application-data configuration is supplied. The asynchronous source-creation case also needs a controlled provider pause at the snapshot-read boundary.
  • 条件不足,未验证:Validate the shared import/conflict/source-plan contracts and state-dependent F5 decision exposed by keymap.decodeImport, keymap.planImportBindings, keymap.planImportSources and debug.startOrContinue.
    • Cargo and rustc are inventoried, but no Windows C compiler/linker or SDK is supplied. The production Core dependency graph includes native C compilation through tree-sitter/ring. No exact-revision prebuilt Core library is supplied either. Provide the native build prerequisites before freezing an executable probe; dependency installation must stay inside the checkout.

未覆盖:

  • The focused-terminal toggle and shell-input requirements remain unverified because their scenario requires an interactive macOS application.
  • Actual IDEA/VS Code parsing, reference defaults, inheritance, override ordering, removal rules, conditional rules, chords and extension handling remain unverified.
  • Native execution of imported find/replace, next/previous match, go-to-line, definition, implementation, references, command search, breakpoint and run/debug shortcuts remains uncovered. Language navigation and real F5 start/continue additionally require production language/debug adapters and a deterministic project fixture; Java is unavailable.
  • The shared Core contract scenario is blocked. Its proposed cases also do not exhaust every byte/count budget, malformed payload, duplicate entry, modifier combination and native key representability boundary.
  • Native conflict presentation, settings revision protection, persistence, restart, undo and preservation of unrelated custom bindings remain unverified.
  • Selected-source filesystem access, snapshot byte/chunk limits, session ownership, permission enforcement, cancellation, expiry, descriptor cleanup and backend teardown need additional native runtime coverage.
  • Stale-source rejection remains unverified, including creation of initially absent files and directory membership changes during an outstanding provider request.
  • Official package verifier acceptance of trusted non-language plugins and rejection of missing backends, undeclared native code, unsafe paths and mismatched trust policies has no selected executable scenario. It requires the macOS Swift verifier and controlled package fixtures.
  • Actual structured failure/warning log files and absence of source contents or local paths remain unverified. Log-window presentation and localization also require desktop acceptance.
  • Installed-package byte immutability across startup, import, terminal and debug workflows remains unverified.
  • Node, Rust and Java SDK compatibility with old/new hosts, public contract synchronization, parser-test CI integration and the review's stale documentation concerns remain uncovered; no external repository or CI service was contacted.
  • Memory, input latency and terminal-key latency comparisons remain uncovered. Performance acceptance needs a prespecified statistical protocol and suitable instrumentation; two functional repetitions cannot establish it.
  • Other IDE versions, profiles, extensions, keyboard layouts and visual/focus behavior remain uncovered. Windows import UI parity is explicitly outside this PR's stated scope.

工作副本与运行状态已清理;可复用编译缓存按 12 GiB / 7 天预算保留。
详细步骤和原始证据保存在服务器受限目录(14 天、总计不超过 1 GiB);当前没有公开下载链接。

@1lck
1lck force-pushed the codex/shortcut-import branch from d3e5c93 to e8b2a76 Compare November 4, 2026 02:21
@1lck
1lck merged commit ced0422 into preview Nov 4, 2026
4 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant