2026-07-14-keybindings-plan.md 1.7 KB

Copy AI Ctx 快捷键支持 — 实现计划

面向 AI 代理的工作者: 必需子技能:使用 superpowers:subagent-driven-development(推荐)或 superpowers:executing-plans 逐任务实现此计划。步骤使用复选框(- [ ])语法来跟踪进度。

目标: 为 Copy AI Ctx 扩展的 4 个命令添加 Ctrl+K C(macOS: Cmd+K C)快捷键支持。

架构: 仅在 package.jsoncontributes 下新增 keybindings 数组,通过 VS Code when 条件自动匹配上下文(编辑器选中/未选中、资源管理器单选/多选),无需修改 TypeScript 代码。

技术栈: VS Code extension manifest(package.json


任务 1:在 package.json 中添加 keybindings 配置

文件:

  • 修改:package.json

  • [ ] 步骤 1:在 contributes 中新增 keybindings 数组

package.jsoncontributes 对象中,在 menus 同级新增 keybindings 数组:

"keybindings": [
  {
    "key": "ctrl+k ctrl+c",
    "command": "copy-ai-ctx.copySelection",
    "when": "editorHasSelection"
  },
  {
    "key": "ctrl+k ctrl+c",
    "command": "copy-ai-ctx.copyFile",
    "when": "!editorHasSelection && editorFocus"
  },
  {
    "key": "ctrl+k ctrl+c",
    "command": "copy-ai-ctx.copySelectedFiles",
    "when": "explorerViewletVisible && !listMultiSelection"
  },
  {
    "key": "ctrl+k ctrl+c",
    "command": "copy-ai-ctx.copyMultiFiles",
    "when": "explorerViewletVisible && listMultiSelection"
  }
]
  • 步骤 2:运行 build 验证配置无语法错误

运行:npm run build

预期:esbuild 打包成功,无报错退出。

  • [ ] 步骤 3:Commit

    git add package.json
    git commit -m "feat: add Ctrl+K C keybinding for all 4 commands"