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;
}
}
log(`[Command] Showing diff for ${absolutePath}`);
await diffManager.showDiff(absolutePath, args.oldText, args.newText);
} catch (error) {
log(`[Command] Error showing diff: ${error}`);

View File

@@ -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)) {

View File

@@ -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 <Component toolCall={toolCall} isFirst={isFirst} isLast={isLast} />;

View File

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