mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 20:31:37 -05:00
Return updated file content when user makes edits to cline's suggestions
This commit is contained in:
@@ -1094,7 +1094,8 @@ export class Cline {
|
|||||||
await this.diffViewProvider.revertChanges()
|
await this.diffViewProvider.revertChanges()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
const { newProblemsMessage, userEdits } = await this.diffViewProvider.saveChanges()
|
const { newProblemsMessage, userEdits, finalContent } =
|
||||||
|
await this.diffViewProvider.saveChanges()
|
||||||
this.didEditFile = true // used to determine if we should wait for busy terminal to update before sending api request
|
this.didEditFile = true // used to determine if we should wait for busy terminal to update before sending api request
|
||||||
if (userEdits) {
|
if (userEdits) {
|
||||||
await this.say(
|
await this.say(
|
||||||
@@ -1106,7 +1107,14 @@ export class Cline {
|
|||||||
} satisfies ClineSayTool)
|
} satisfies ClineSayTool)
|
||||||
)
|
)
|
||||||
pushToolResult(
|
pushToolResult(
|
||||||
`The user made the following updates to your content:\n\n${userEdits}\n\nThe updated content, which includes both your original modifications and the user's additional edits, has been successfully saved to ${relPath.toPosix()}. (Note this does not mean you need to re-write the file with the user's changes, as they have already been applied to the file.)${newProblemsMessage}`
|
`The user made the following updates to your content:\n\n${userEdits}\n\n` +
|
||||||
|
`The updated content, which includes both your original modifications and the user's edits, has been successfully saved to ${relPath.toPosix()}. Here is the full, updated content of the file:\n\n` +
|
||||||
|
`<final_file_content path="${relPath.toPosix()}">\n${finalContent}\n</final_file_content>\n\n` +
|
||||||
|
`Please note:\n` +
|
||||||
|
`1. You do not need to re-write the file with these changes, as they have already been applied.\n` +
|
||||||
|
`2. Proceed with the task using this updated file content as the new baseline.\n` +
|
||||||
|
`3. If the user's edits have addressed part of the task or changed the requirements, adjust your approach accordingly.` +
|
||||||
|
`${newProblemsMessage}`
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
pushToolResult(
|
pushToolResult(
|
||||||
|
|||||||
@@ -138,9 +138,13 @@ export class DiffViewProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveChanges(): Promise<{ newProblemsMessage: string | undefined; userEdits: string | undefined }> {
|
async saveChanges(): Promise<{
|
||||||
|
newProblemsMessage: string | undefined
|
||||||
|
userEdits: string | undefined
|
||||||
|
finalContent: string | undefined
|
||||||
|
}> {
|
||||||
if (!this.relPath || !this.newContent || !this.activeDiffEditor) {
|
if (!this.relPath || !this.newContent || !this.activeDiffEditor) {
|
||||||
return { newProblemsMessage: undefined, userEdits: undefined }
|
return { newProblemsMessage: undefined, userEdits: undefined, finalContent: undefined }
|
||||||
}
|
}
|
||||||
const absolutePath = path.resolve(this.cwd, this.relPath)
|
const absolutePath = path.resolve(this.cwd, this.relPath)
|
||||||
const updatedDocument = this.activeDiffEditor.document
|
const updatedDocument = this.activeDiffEditor.document
|
||||||
@@ -192,10 +196,10 @@ export class DiffViewProvider {
|
|||||||
normalizedNewContent,
|
normalizedNewContent,
|
||||||
normalizedEditedContent
|
normalizedEditedContent
|
||||||
)
|
)
|
||||||
return { newProblemsMessage, userEdits }
|
return { newProblemsMessage, userEdits, finalContent: normalizedEditedContent }
|
||||||
} else {
|
} else {
|
||||||
// no changes to cline's edits
|
// no changes to cline's edits
|
||||||
return { newProblemsMessage, userEdits: undefined }
|
return { newProblemsMessage, userEdits: undefined, finalContent: normalizedEditedContent }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user