Skip to content

Commit e56b922

Browse files
committed
refactor: keep original file name for apply diff tool
1 parent 2557d4a commit e56b922

File tree

5 files changed

+711
-698
lines changed

5 files changed

+711
-698
lines changed

src/core/assistant-message/presentAssistantMessage.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { fetchInstructionsTool } from "../tools/fetchInstructionsTool"
1111
import { listFilesTool } from "../tools/listFilesTool"
1212
import { getReadFileToolDescription, readFileTool } from "../tools/readFileTool"
1313
import { writeToFileTool } from "../tools/writeToFileTool"
14-
import { applyDiffTool } from "../tools/applyDiffTool"
14+
import { applyDiffTool } from "../tools/multiApplyDiffTool"
1515
import { insertContentTool } from "../tools/insertContentTool"
1616
import { searchAndReplaceTool } from "../tools/searchAndReplaceTool"
1717
import { listCodeDefinitionNamesTool } from "../tools/listCodeDefinitionNamesTool"
@@ -31,6 +31,8 @@ import { formatResponse } from "../prompts/responses"
3131
import { validateToolUse } from "../tools/validateToolUse"
3232
import { Task } from "../task/Task"
3333
import { codebaseSearchTool } from "../tools/codebaseSearchTool"
34+
import { experiments } from "../../shared/experiments"
35+
import { applyDiffToolLegacy } from "../tools/applyDiffTool"
3436

3537
/**
3638
* Processes and presents assistant message content to the user interface.
@@ -385,7 +387,18 @@ export async function presentAssistantMessage(cline: Task) {
385387
await writeToFileTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
386388
break
387389
case "apply_diff":
388-
await applyDiffTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
390+
if (experiments.get("MULTI_FILE_APPLY_DIFF")?.enabled) {
391+
await applyDiffTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)
392+
} else {
393+
await applyDiffToolLegacy(
394+
cline,
395+
block,
396+
askApproval,
397+
handleError,
398+
pushToolResult,
399+
removeClosingTag,
400+
)
401+
}
389402
break
390403
case "insert_content":
391404
await insertContentTool(cline, block, askApproval, handleError, pushToolResult, removeClosingTag)

src/core/tools/__tests__/applyDiffTool.experiment.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, it, expect, vi, beforeEach } from "vitest"
2-
import { applyDiffTool } from "../applyDiffTool"
3-
import { applyDiffToolLegacy } from "../applyDiffToolLegacy"
2+
import { applyDiffTool } from "../multiApplyDiffTool"
3+
import { applyDiffToolLegacy } from "../applyDiffTool"
44
import { Task } from "../../task/Task"
55
import { EXPERIMENT_IDS, experiments } from "../../../shared/experiments"
66

0 commit comments

Comments
 (0)