chore(vscode-ide-companion): temporarily annotate some logic to suppress showDiff

This commit is contained in:
yiliang114
2025-12-08 10:18:55 +08:00
parent be71976a1f
commit 63e4794633
4 changed files with 41 additions and 39 deletions

View File

@@ -58,7 +58,7 @@ export function registerNewCommands(
).fsPath; ).fsPath;
} }
} }
log(`[Command] Showing diff for ${absolutePath}`);
await diffManager.showDiff(absolutePath, args.oldText, args.newText); await diffManager.showDiff(absolutePath, args.oldText, args.newText);
} catch (error) { } catch (error) {
log(`[Command] Error showing diff: ${error}`); log(`[Command] Error showing diff: ${error}`);

View File

@@ -165,46 +165,47 @@ export class DiffManager {
const normalizedPath = path.normalize(filePath); const normalizedPath = path.normalize(filePath);
const key = this.makeKey(normalizedPath, oldContent, newContent); const key = this.makeKey(normalizedPath, oldContent, newContent);
// Suppress entirely when the extension indicates diffs should not be shown // TODO:
if (this.shouldSuppress && this.shouldSuppress()) { // // Suppress entirely when the extension indicates diffs should not be shown
this.log(`showDiff suppressed by policy for ${filePath}`); // if (this.shouldSuppress && this.shouldSuppress()) {
return; // this.log(`showDiff suppressed by policy for ${filePath}`);
} // return;
// }
// Suppress during timed window // // Suppress during timed window
if (this.suppressUntil && Date.now() < this.suppressUntil) { // if (this.suppressUntil && Date.now() < this.suppressUntil) {
this.log(`showDiff suppressed by timed window for ${filePath}`); // this.log(`showDiff suppressed by timed window for ${filePath}`);
return; // return;
} // }
// If permission drawer is currently open, delay to avoid double-open // // If permission drawer is currently open, delay to avoid double-open
if (this.shouldDelay && this.shouldDelay()) { // if (this.shouldDelay && this.shouldDelay()) {
if (!this.pendingDelayTimers.has(key)) { // if (!this.pendingDelayTimers.has(key)) {
const timer = setTimeout(() => { // const timer = setTimeout(() => {
this.pendingDelayTimers.delete(key); // this.pendingDelayTimers.delete(key);
// Fire and forget; rely on dedupe below to avoid double focus // // Fire and forget; rely on dedupe below to avoid double focus
void this.showDiff(filePath, oldContent, newContent); // void this.showDiff(filePath, oldContent, newContent);
}, 300); // }, 300);
this.pendingDelayTimers.set(key, timer); // this.pendingDelayTimers.set(key, timer);
} // }
return; // return;
} // }
// If a diff tab for the same file is already open, update its content instead of opening a new one // // 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()) { // for (const [, diffInfo] of this.diffDocuments.entries()) {
if (diffInfo.originalFilePath === normalizedPath) { // if (diffInfo.originalFilePath === normalizedPath) {
// Update left/right contents // // Update left/right contents
this.diffContentProvider.setContent(diffInfo.leftDocUri, oldContent); // this.diffContentProvider.setContent(diffInfo.leftDocUri, oldContent);
this.diffContentProvider.setContent(diffInfo.rightDocUri, newContent); // this.diffContentProvider.setContent(diffInfo.rightDocUri, newContent);
// Update stored snapshot for future comparisons // // Update stored snapshot for future comparisons
diffInfo.oldContent = oldContent; // diffInfo.oldContent = oldContent;
diffInfo.newContent = newContent; // diffInfo.newContent = newContent;
this.recentlyShown.set(key, Date.now()); // this.recentlyShown.set(key, Date.now());
// Soft focus existing (preserve chat focus) // // Soft focus existing (preserve chat focus)
await this.focusExistingDiff(normalizedPath); // await this.focusExistingDiff(normalizedPath);
return; // return;
} // }
} // }
// Check if a diff view with the same content already exists // Check if a diff view with the same content already exists
if (this.hasExistingDiff(normalizedPath, oldContent, newContent)) { if (this.hasExistingDiff(normalizedPath, oldContent, newContent)) {

View File

@@ -80,7 +80,7 @@ export const ToolCallRouter: React.FC<
} }
// Get the appropriate component for this kind // Get the appropriate component for this kind
const Component = getToolCallComponent(toolCall.kind, toolCall); const Component = getToolCallComponent(toolCall.kind);
// Render the specialized component // Render the specialized component
return <Component toolCall={toolCall} isFirst={isFirst} isLast={isLast} />; return <Component toolCall={toolCall} isFirst={isFirst} isLast={isLast} />;

View File

@@ -49,6 +49,7 @@ export class FileMessageHandler extends BaseMessageHandler {
break; break;
case 'openDiff': case 'openDiff':
console.log('[FileMessageHandler ===== ] openDiff called with:', data);
await this.handleOpenDiff(data); await this.handleOpenDiff(data);
break; break;