From cc4825efc37ac572dffb2e2ed35ba284c5bb99dd Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Fri, 11 Oct 2024 01:22:50 -0400 Subject: [PATCH] Fix issue where cline's edits would stream into active editor instead of diff view editor --- src/integrations/editor/DiffViewProvider.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/integrations/editor/DiffViewProvider.ts b/src/integrations/editor/DiffViewProvider.ts index bdea2c6..206d206 100644 --- a/src/integrations/editor/DiffViewProvider.ts +++ b/src/integrations/editor/DiffViewProvider.ts @@ -89,16 +89,12 @@ export class DiffViewProvider { accumulatedLines.pop() // remove the last partial line only if it's not the final update } const diffLines = accumulatedLines.slice(this.streamedLines.length) - const document = vscode.window.activeTextEditor?.document + + const document = this.activeDiffEditor?.document if (!document) { - console.error("No active text editor") - return - } - const diffViewEditor = vscode.window.activeTextEditor - if (!diffViewEditor) { - console.error("No active diff view editor") - return + throw new Error("User closed text editor, unable to edit file...") } + for (let i = 0; i < diffLines.length; i++) { const currentLine = this.streamedLines.length + i // Replace all content up to the current line with accumulated lines