mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 20:31:37 -05:00
Only calc diff to scroll to if fileExists
This commit is contained in:
@@ -848,20 +848,22 @@ export class ClaudeDev {
|
|||||||
await vscode.workspace.applyEdit(edit) // has the added benefit of maintaing the file's original EOLs
|
await vscode.workspace.applyEdit(edit) // has the added benefit of maintaing the file's original EOLs
|
||||||
|
|
||||||
// Find the first range where the content differs and scroll to it
|
// Find the first range where the content differs and scroll to it
|
||||||
const diffResult = diff.diffLines(originalContent, newContent)
|
if (fileExists) {
|
||||||
for (let i = 0, lineCount = 0; i < diffResult.length; i++) {
|
const diffResult = diff.diffLines(originalContent, newContent)
|
||||||
const part = diffResult[i]
|
for (let i = 0, lineCount = 0; i < diffResult.length; i++) {
|
||||||
if (part.added || part.removed) {
|
const part = diffResult[i]
|
||||||
const startLine = lineCount + 1
|
if (part.added || part.removed) {
|
||||||
const endLine = lineCount + (part.count || 0)
|
const startLine = lineCount + 1
|
||||||
vscode.window.activeTextEditor?.revealRange(
|
const endLine = lineCount + (part.count || 0)
|
||||||
// + 3 to move the editor up slightly as this looks better
|
vscode.window.activeTextEditor?.revealRange(
|
||||||
new vscode.Range(new vscode.Position(startLine, 0), new vscode.Position(endLine + 3, 0)),
|
// + 3 to move the editor up slightly as this looks better
|
||||||
vscode.TextEditorRevealType.InCenter
|
new vscode.Range(new vscode.Position(startLine, 0), new vscode.Position(endLine + 3, 0)),
|
||||||
)
|
vscode.TextEditorRevealType.InCenter
|
||||||
break
|
)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
lineCount += part.count || 0
|
||||||
}
|
}
|
||||||
lineCount += part.count || 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove cursor from the document
|
// remove cursor from the document
|
||||||
|
|||||||
Reference in New Issue
Block a user