mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Refactor applyDiff methods in search-replace and unified strategies to return Promises for asynchronous handling
This commit is contained in:
@@ -126,7 +126,7 @@ Your search/replace content here
|
|||||||
</apply_diff>`
|
</apply_diff>`
|
||||||
}
|
}
|
||||||
|
|
||||||
applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): DiffResult {
|
async applyDiff(originalContent: string, diffContent: string, startLine?: number, endLine?: number): Promise<DiffResult> {
|
||||||
// Extract the search and replace blocks
|
// Extract the search and replace blocks
|
||||||
const match = diffContent.match(/<<<<<<< SEARCH\n([\s\S]*?)\n?=======\n([\s\S]*?)\n?>>>>>>> REPLACE/);
|
const match = diffContent.match(/<<<<<<< SEARCH\n([\s\S]*?)\n?=======\n([\s\S]*?)\n?>>>>>>> REPLACE/);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ Your diff here
|
|||||||
</apply_diff>`
|
</apply_diff>`
|
||||||
}
|
}
|
||||||
|
|
||||||
applyDiff(originalContent: string, diffContent: string): DiffResult {
|
async applyDiff(originalContent: string, diffContent: string): Promise<DiffResult> {
|
||||||
try {
|
try {
|
||||||
const result = applyPatch(originalContent, diffContent)
|
const result = applyPatch(originalContent, diffContent)
|
||||||
if (result === false) {
|
if (result === false) {
|
||||||
|
|||||||
Reference in New Issue
Block a user