Refactor applyDiff methods in search-replace and unified strategies to return Promises for asynchronous handling

This commit is contained in:
Daniel Riccio
2025-01-07 18:59:55 -05:00
parent 420c6c72dd
commit 70cf27071b
2 changed files with 2 additions and 2 deletions

View File

@@ -126,7 +126,7 @@ Your search/replace content here
</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
const match = diffContent.match(/<<<<<<< SEARCH\n([\s\S]*?)\n?=======\n([\s\S]*?)\n?>>>>>>> REPLACE/);
if (!match) {

View File

@@ -108,7 +108,7 @@ Your diff here
</apply_diff>`
}
applyDiff(originalContent: string, diffContent: string): DiffResult {
async applyDiff(originalContent: string, diffContent: string): Promise<DiffResult> {
try {
const result = applyPatch(originalContent, diffContent)
if (result === false) {