From 63e4794633d9f0cfe65cce71cd83387573419974 Mon Sep 17 00:00:00 2001 From: yiliang114 <1204183885@qq.com> Date: Mon, 8 Dec 2025 10:18:55 +0800 Subject: [PATCH] chore(vscode-ide-companion): temporarily annotate some logic to suppress showDiff --- .../src/commands/index.ts | 2 +- .../vscode-ide-companion/src/diff-manager.ts | 75 ++++++++++--------- .../components/messages/toolcalls/index.tsx | 2 +- .../webview/handlers/FileMessageHandler.ts | 1 + 4 files changed, 41 insertions(+), 39 deletions(-) diff --git a/packages/vscode-ide-companion/src/commands/index.ts b/packages/vscode-ide-companion/src/commands/index.ts index 50e9e3c9..22262752 100644 --- a/packages/vscode-ide-companion/src/commands/index.ts +++ b/packages/vscode-ide-companion/src/commands/index.ts @@ -58,7 +58,7 @@ export function registerNewCommands( ).fsPath; } } - + log(`[Command] Showing diff for ${absolutePath}`); await diffManager.showDiff(absolutePath, args.oldText, args.newText); } catch (error) { log(`[Command] Error showing diff: ${error}`); diff --git a/packages/vscode-ide-companion/src/diff-manager.ts b/packages/vscode-ide-companion/src/diff-manager.ts index 5d38d77e..bc14adc0 100644 --- a/packages/vscode-ide-companion/src/diff-manager.ts +++ b/packages/vscode-ide-companion/src/diff-manager.ts @@ -165,46 +165,47 @@ export class DiffManager { const normalizedPath = path.normalize(filePath); const key = this.makeKey(normalizedPath, oldContent, newContent); - // Suppress entirely when the extension indicates diffs should not be shown - if (this.shouldSuppress && this.shouldSuppress()) { - this.log(`showDiff suppressed by policy for ${filePath}`); - return; - } + // TODO: + // // Suppress entirely when the extension indicates diffs should not be shown + // if (this.shouldSuppress && this.shouldSuppress()) { + // this.log(`showDiff suppressed by policy for ${filePath}`); + // return; + // } - // Suppress during timed window - if (this.suppressUntil && Date.now() < this.suppressUntil) { - this.log(`showDiff suppressed by timed window for ${filePath}`); - return; - } + // // Suppress during timed window + // if (this.suppressUntil && Date.now() < this.suppressUntil) { + // this.log(`showDiff suppressed by timed window for ${filePath}`); + // return; + // } - // If permission drawer is currently open, delay to avoid double-open - if (this.shouldDelay && this.shouldDelay()) { - if (!this.pendingDelayTimers.has(key)) { - const timer = setTimeout(() => { - this.pendingDelayTimers.delete(key); - // Fire and forget; rely on dedupe below to avoid double focus - void this.showDiff(filePath, oldContent, newContent); - }, 300); - this.pendingDelayTimers.set(key, timer); - } - return; - } + // // If permission drawer is currently open, delay to avoid double-open + // if (this.shouldDelay && this.shouldDelay()) { + // if (!this.pendingDelayTimers.has(key)) { + // const timer = setTimeout(() => { + // this.pendingDelayTimers.delete(key); + // // Fire and forget; rely on dedupe below to avoid double focus + // void this.showDiff(filePath, oldContent, newContent); + // }, 300); + // this.pendingDelayTimers.set(key, timer); + // } + // return; + // } - // If a diff tab for the same file is already open, update its content instead of opening a new one - for (const [, diffInfo] of this.diffDocuments.entries()) { - if (diffInfo.originalFilePath === normalizedPath) { - // Update left/right contents - this.diffContentProvider.setContent(diffInfo.leftDocUri, oldContent); - this.diffContentProvider.setContent(diffInfo.rightDocUri, newContent); - // Update stored snapshot for future comparisons - diffInfo.oldContent = oldContent; - diffInfo.newContent = newContent; - this.recentlyShown.set(key, Date.now()); - // Soft focus existing (preserve chat focus) - await this.focusExistingDiff(normalizedPath); - return; - } - } + // // If a diff tab for the same file is already open, update its content instead of opening a new one + // for (const [, diffInfo] of this.diffDocuments.entries()) { + // if (diffInfo.originalFilePath === normalizedPath) { + // // Update left/right contents + // this.diffContentProvider.setContent(diffInfo.leftDocUri, oldContent); + // this.diffContentProvider.setContent(diffInfo.rightDocUri, newContent); + // // Update stored snapshot for future comparisons + // diffInfo.oldContent = oldContent; + // diffInfo.newContent = newContent; + // this.recentlyShown.set(key, Date.now()); + // // Soft focus existing (preserve chat focus) + // await this.focusExistingDiff(normalizedPath); + // return; + // } + // } // Check if a diff view with the same content already exists if (this.hasExistingDiff(normalizedPath, oldContent, newContent)) { diff --git a/packages/vscode-ide-companion/src/webview/components/messages/toolcalls/index.tsx b/packages/vscode-ide-companion/src/webview/components/messages/toolcalls/index.tsx index 18a0fbf3..3f7a2bc0 100644 --- a/packages/vscode-ide-companion/src/webview/components/messages/toolcalls/index.tsx +++ b/packages/vscode-ide-companion/src/webview/components/messages/toolcalls/index.tsx @@ -80,7 +80,7 @@ export const ToolCallRouter: React.FC< } // Get the appropriate component for this kind - const Component = getToolCallComponent(toolCall.kind, toolCall); + const Component = getToolCallComponent(toolCall.kind); // Render the specialized component return ; diff --git a/packages/vscode-ide-companion/src/webview/handlers/FileMessageHandler.ts b/packages/vscode-ide-companion/src/webview/handlers/FileMessageHandler.ts index 28ecbbd3..f82525f7 100644 --- a/packages/vscode-ide-companion/src/webview/handlers/FileMessageHandler.ts +++ b/packages/vscode-ide-companion/src/webview/handlers/FileMessageHandler.ts @@ -49,6 +49,7 @@ export class FileMessageHandler extends BaseMessageHandler { break; case 'openDiff': + console.log('[FileMessageHandler ===== ] openDiff called with:', data); await this.handleOpenDiff(data); break;