feat(vscode-ide-companion): 更新核心服务和扩展功能

- 增强 extension.ts,集成新增功能
- 优化 ide-server.ts,改进服务端逻辑
- 更新 diff-manager.ts,提升差异管理能力
- 改进 ACP 连接和消息处理
- 更新会话处理器,支持新的交互模式

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
yiliang114
2025-11-21 01:54:24 +08:00
parent ecc6e22002
commit e2beecb9c4
6 changed files with 68 additions and 19 deletions

View File

@@ -437,7 +437,18 @@ const createMcpServer = (diffManager: DiffManager) => {
inputSchema: OpenDiffRequestSchema.shape,
},
async ({ filePath, newContent }: z.infer<typeof OpenDiffRequestSchema>) => {
await diffManager.showDiff(filePath, newContent);
// Read old content if file exists, otherwise use empty string
let oldContent = '';
try {
const fileUri = vscode.Uri.file(filePath);
const document = await vscode.workspace.openTextDocument(fileUri);
oldContent = document.getText();
} catch (_error) {
// File doesn't exist, use empty string (creating new file)
oldContent = '';
}
await diffManager.showDiff(filePath, oldContent, newContent);
return { content: [] };
},
);