{ "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: 上一个变更" }, { "command": "aiDiffPreview.nextEdit", "title": "AI Diff: 下一次编辑" }, { "command": "aiDiffPreview.prevEdit", "title": "AI Diff: 上一次编辑" }, { "command": "aiDiffPreview.showEditAtIndex", "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" }, { "command": "aiDiffPreview.nextEdit", "key": "alt+right", "mac": "alt+right", "when": "aiDiffPreview.isActive" }, { "command": "aiDiffPreview.prevEdit", "key": "alt+left", "mac": "alt+left", "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": "最大处理文件大小(字符数)" }, "aiDiffPreview.idleTimeout": { "type": "number", "default": 3000, "description": "空闲检测超时时间(毫秒)。在此时间内无新编辑事件,自动触发 Diff 提示(用于 ESC 打断场景)。设为 0 则禁用此功能" } } } }, "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": { "@esbuild/win32-x64": "^0.28.1", "@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" } }