summaryrefslogtreecommitdiff
path: root/packages/server/src/tools/write-file.ts
diff options
context:
space:
mode:
authorTaylor Mullen <[email protected]>2025-05-15 23:51:53 -0700
committerN. Taylor Mullen <[email protected]>2025-05-16 10:13:13 -0700
commit968e09f0b50d17f7c591baa977666b991a1e59b7 (patch)
treee7d7e6ea7211003074a6b967b3736457972fc927 /packages/server/src/tools/write-file.ts
parentdce7d2c4f799d537b2be00fe28e2b872550fc77d (diff)
fix: Ensure filename is available for diff rendering in write-file
This commit resolves a bug where the `write-file` operation could fail to render content due to a missing filename. The fix involves: - Ensuring `fileName` is consistently passed to `DiffRenderer.tsx` through `ToolConfirmationMessage.tsx`, `ToolMessage.tsx`, and `useGeminiStream.ts`. - Modifying `edit.ts` and `write-file.ts` to include `fileName` in the `FileDiff` object. - Expanding the `FileDiff` interface in `tools.ts` to include `fileName`. Additionally, this commit enhances the diff rendering by: - Adding syntax highlighting based on file extension in `DiffRenderer.tsx`. - Adding more language mappings to `getLanguageFromExtension` in `DiffRenderer.tsx`. - Added lots of tests for all the above. Fixes https://b.corp.google.com/issues/418125982
Diffstat (limited to 'packages/server/src/tools/write-file.ts')
-rw-r--r--packages/server/src/tools/write-file.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/packages/server/src/tools/write-file.ts b/packages/server/src/tools/write-file.ts
index 44794a2d..21178b5b 100644
--- a/packages/server/src/tools/write-file.ts
+++ b/packages/server/src/tools/write-file.ts
@@ -202,7 +202,7 @@ export class WriteFileTool extends BaseTool<WriteFileToolParams, ToolResult> {
? `Successfully created and wrote to new file: ${params.file_path}`
: `Successfully overwrote file: ${params.file_path}`;
- const displayResult: FileDiff = { fileDiff };
+ const displayResult: FileDiff = { fileDiff, fileName };
return {
llmContent: llmSuccessMessage,