refactor: 架构变更:Webview → VSCode 内置 Diff + 浮动标签

This commit is contained in:
2026-06-18 08:05:24 +08:00
parent f06914994d
commit fcda651760
7 changed files with 548 additions and 98 deletions
+68 -19
View File
@@ -1,8 +1,8 @@
{
"name": "ai-diff-preview",
"displayName": "AI Code Diff Preview",
"description": "类 Cursor 的 AI 代码差异预览插件,支持 Accept/Reject 操作",
"version": "0.1.0",
"description": "类 Cursor 的 AI 代码差异预览插件,使用 VSCode 内置 Diff 编辑器 + 浮动 Accept/Reject 标签",
"version": "0.2.0",
"publisher": "your-publisher-name",
"engines": {
"vscode": "^1.85.0"
@@ -17,13 +17,23 @@
"contributes": {
"commands": [
{
"command": "aiDiffPreview.acceptChunk",
"title": "AI Diff: 接受当前变更块",
"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.rejectChunk",
"title": "AI Diff: 拒绝当前变更块",
"command": "aiDiffPreview.rejectCurrentEdit",
"title": "AI Diff: 拒绝当前编辑",
"icon": "$(close)"
},
{
@@ -37,21 +47,24 @@
"icon": "$(trash)"
},
{
"command": "aiDiffPreview.showDiffPanel",
"title": "AI Diff: 显示 Diff 面板",
"icon": "$(diff)"
"command": "aiDiffPreview.nextDiff",
"title": "AI Diff: 下一个变更"
},
{
"command": "aiDiffPreview.prevDiff",
"title": "AI Diff: 上一个变更"
}
],
"keybindings": [
{
"command": "aiDiffPreview.acceptChunk",
"command": "aiDiffPreview.acceptCurrentEdit",
"key": "tab",
"when": "aiDiffPreview.isActive"
"when": "aiDiffPreview.isActive && editorTextFocus"
},
{
"command": "aiDiffPreview.rejectAll",
"key": "escape",
"when": "aiDiffPreview.isActive"
"when": "aiDiffPreview.isActive && editorTextFocus"
},
{
"command": "aiDiffPreview.acceptAll",
@@ -64,6 +77,30 @@
"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": {
@@ -72,17 +109,29 @@
"aiDiffPreview.enableAutoTrigger": {
"type": "boolean",
"default": true,
"description": "启用 Claude Hooks 自动触发"
"description": "启用自动触发(监听 pending.json 文件变更)"
},
"aiDiffPreview.showInlineButtons": {
"aiDiffPreview.autoShowDiffPerEdit": {
"type": "boolean",
"default": false,
"description": "每次 Edit/Write 后自动弹出 VSCode 内置 Diff 编辑器。关闭时静默收集变更,等待 Stop 后统一展示"
},
"aiDiffPreview.showAllDiffsOnStop": {
"type": "boolean",
"default": true,
"description": "显示内联 Accept/Reject 按钮"
"description": "对话结束后自动弹出 QuickPick 文件列表,展示所有变更文件。关闭时仅显示状态栏通知"
},
"aiDiffPreview.autoLint": {
"type": "boolean",
"default": true,
"description": "Diff 预览时自动运行 Lint 检查"
"aiDiffPreview.floatingLabelMode": {
"type": "string",
"default": "statusBar",
"enum": ["inline", "statusBar", "both", "none"],
"enumDescriptions": [
"编辑器行内 Accept/Reject 标签(通过 CodeLens 显示)",
"状态栏底部固定 Accept/Reject 按钮",
"两者都显示",
"不显示浮动标签"
],
"description": "Accept/Reject 浮动标签显示位置"
},
"aiDiffPreview.maxFileSize": {
"type": "number",