mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
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:
@@ -76,15 +76,26 @@ export class DiffManager {
|
||||
|
||||
/**
|
||||
* Creates and shows a new diff view.
|
||||
* @param filePath Path to the file being diffed
|
||||
* @param oldContent The original content (left side)
|
||||
* @param newContent The modified content (right side)
|
||||
*/
|
||||
async showDiff(filePath: string, newContent: string) {
|
||||
const fileUri = vscode.Uri.file(filePath);
|
||||
async showDiff(filePath: string, oldContent: string, newContent: string) {
|
||||
const _fileUri = vscode.Uri.file(filePath);
|
||||
|
||||
// Left side: old content using qwen-diff scheme
|
||||
const leftDocUri = vscode.Uri.from({
|
||||
scheme: DIFF_SCHEME,
|
||||
path: filePath,
|
||||
query: `old&rand=${Math.random()}`,
|
||||
});
|
||||
this.diffContentProvider.setContent(leftDocUri, oldContent);
|
||||
|
||||
// Right side: new content using qwen-diff scheme
|
||||
const rightDocUri = vscode.Uri.from({
|
||||
scheme: DIFF_SCHEME,
|
||||
path: filePath,
|
||||
// cache busting
|
||||
query: `rand=${Math.random()}`,
|
||||
query: `new&rand=${Math.random()}`,
|
||||
});
|
||||
this.diffContentProvider.setContent(rightDocUri, newContent);
|
||||
|
||||
@@ -94,26 +105,13 @@ export class DiffManager {
|
||||
rightDocUri,
|
||||
});
|
||||
|
||||
const diffTitle = `${path.basename(filePath)} ↔ Modified`;
|
||||
const diffTitle = `${path.basename(filePath)} (Before ↔ After)`;
|
||||
await vscode.commands.executeCommand(
|
||||
'setContext',
|
||||
'qwen.diff.isVisible',
|
||||
true,
|
||||
);
|
||||
|
||||
let leftDocUri;
|
||||
try {
|
||||
await vscode.workspace.fs.stat(fileUri);
|
||||
leftDocUri = fileUri;
|
||||
} catch {
|
||||
// We need to provide an empty document to diff against.
|
||||
// Using the 'untitled' scheme is one way to do this.
|
||||
leftDocUri = vscode.Uri.from({
|
||||
scheme: 'untitled',
|
||||
path: filePath,
|
||||
});
|
||||
}
|
||||
|
||||
await vscode.commands.executeCommand(
|
||||
'vscode.diff',
|
||||
leftDocUri,
|
||||
|
||||
Reference in New Issue
Block a user