Files
ai-diff-preview/package.json
T
Gmarker689 dfa3a585c5 v0.2.0: VSCode内置Diff + QuickPick总览 + EditRecord粒度 + Bug修复
新增:
- VSCode内置Diff编辑器 (diffViewer.ts) 替代Webview,零保存提示
- EditRecord独立追踪: 每次Edit/Write不合并,支持逐次编辑Accept/Reject
- QuickPick文件列表总览,含Accept All / Reject All
- 智能Auto-Advance: Accept/Reject后自动推进,同文件多编辑智能停留
- 状态栏常驻显示  AI Diff,Diff模式下切换为操作按钮

修复:
- Accept后同文件再编辑不触发选项 (pending-priority匹配)
- Accept All / Reject All写入与状态顺序修复
- acceptFile/rejectFile改为先写入成功再标记状态
- 同文件多个FileChange孤儿编辑问题

变更:
- ChangeSetManager重构为EditRecord[] + FileChange聚合
- HookHandler精简,QuickPick移入hookHandler
- 移除InlineDecorator/CodeLens (主流程),ReviewPanel降级为备用
- package.json: publisher=YonHao Guo, repository, v0.2.0, 新配置项/快捷键

测试: 13/13通过 (7 diffEngine + 6 changeSetManager回归)
2026-06-18 19:37:21 +08:00

176 lines
5.3 KiB
JSON

{
"name": "ai-diff-preview",
"displayName": "AI Code Diff Preview",
"description": "类 Cursor 的 AI 代码差异预览插件,使用 VSCode 内置 Diff 编辑器 + 浮动 Accept/Reject 标签",
"version": "0.2.0",
"publisher": "Gmaker689",
"repository": {
"type": "git",
"url": "https://github.com/Gmaker689/ai-diff-preview"
},
"engines": {
"vscode": "^1.85.0"
},
"categories": [
"Linters",
"Programming Languages",
"Other"
],
"activationEvents": ["onStartupFinished"],
"main": "./dist/extension.js",
"contributes": {
"commands": [
{
"command": "aiDiffPreview.showDiffPanel",
"title": "AI Diff: 显示所有变更文件列表",
"icon": "$(list-tree)"
},
{
"command": "aiDiffPreview.showCurrentFileDiff",
"title": "AI Diff: 查看当前文件 Diff",
"icon": "$(diff)"
},
{
"command": "aiDiffPreview.acceptCurrentEdit",
"title": "AI Diff: 接受当前编辑",
"icon": "$(check)"
},
{
"command": "aiDiffPreview.rejectCurrentEdit",
"title": "AI Diff: 拒绝当前编辑",
"icon": "$(close)"
},
{
"command": "aiDiffPreview.acceptAll",
"title": "AI Diff: 接受所有变更",
"icon": "$(check-all)"
},
{
"command": "aiDiffPreview.rejectAll",
"title": "AI Diff: 拒绝所有变更",
"icon": "$(trash)"
},
{
"command": "aiDiffPreview.nextDiff",
"title": "AI Diff: 下一个变更"
},
{
"command": "aiDiffPreview.prevDiff",
"title": "AI Diff: 上一个变更"
}
],
"keybindings": [
{
"command": "aiDiffPreview.acceptCurrentEdit",
"key": "tab",
"when": "aiDiffPreview.isActive && editorTextFocus"
},
{
"command": "aiDiffPreview.rejectAll",
"key": "escape",
"when": "aiDiffPreview.isActive && editorTextFocus"
},
{
"command": "aiDiffPreview.acceptAll",
"key": "ctrl+shift+a",
"mac": "cmd+shift+a",
"when": "aiDiffPreview.isActive"
},
{
"command": "aiDiffPreview.rejectAll",
"key": "ctrl+shift+r",
"mac": "cmd+shift+r",
"when": "aiDiffPreview.isActive"
},
{
"command": "aiDiffPreview.nextDiff",
"key": "alt+down",
"mac": "alt+down",
"when": "aiDiffPreview.isActive"
},
{
"command": "aiDiffPreview.prevDiff",
"key": "alt+up",
"mac": "alt+up",
"when": "aiDiffPreview.isActive"
},
{
"command": "aiDiffPreview.showDiffPanel",
"key": "ctrl+shift+d",
"mac": "cmd+shift+d",
"when": "aiDiffPreview.isActive"
},
{
"command": "aiDiffPreview.showCurrentFileDiff",
"key": "ctrl+shift+f",
"mac": "cmd+shift+f",
"when": "aiDiffPreview.isActive"
}
],
"configuration": {
"title": "AI Diff Preview",
"properties": {
"aiDiffPreview.enableAutoTrigger": {
"type": "boolean",
"default": true,
"description": "启用自动触发(监听 pending.json 文件变更)"
},
"aiDiffPreview.autoShowDiffPerEdit": {
"type": "boolean",
"default": false,
"description": "每次 Edit/Write 后自动弹出 VSCode 内置 Diff 编辑器。关闭时静默收集变更,等待 Stop 后统一展示"
},
"aiDiffPreview.showAllDiffsOnStop": {
"type": "boolean",
"default": true,
"description": "对话结束后自动弹出 QuickPick 文件列表,展示所有变更文件。关闭时仅显示状态栏通知"
},
"aiDiffPreview.floatingLabelMode": {
"type": "string",
"default": "statusBar",
"enum": ["inline", "statusBar", "both", "none"],
"enumDescriptions": [
"编辑器行内 Accept/Reject 标签(通过 CodeLens 显示)",
"状态栏底部固定 Accept/Reject 按钮",
"两者都显示",
"不显示浮动标签"
],
"description": "Accept/Reject 浮动标签显示位置"
},
"aiDiffPreview.maxFileSize": {
"type": "number",
"default": 100000,
"description": "最大处理文件大小(字符数)"
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run build",
"build": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node --minify",
"watch": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node --sourcemap --watch",
"lint": "eslint src --ext ts",
"test": "vitest run",
"test:watch": "vitest",
"package": "vsce package"
},
"devDependencies": {
"@types/diff": "^5.0.0",
"@types/node": "^20.0.0",
"@types/uuid": "^9.0.0",
"@types/vscode": "^1.85.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vscode/test-electron": "^2.3.0",
"esbuild": "^0.19.0",
"eslint": "^8.0.0",
"prettier": "^3.0.0",
"typescript": "^5.3.0",
"vitest": "^1.0.0"
},
"dependencies": {
"diff": "^5.0.0",
"uuid": "^9.0.0"
}
}