summaryrefslogtreecommitdiff
path: root/packages/server/src/tools/edit.ts
diff options
context:
space:
mode:
authorTaylor Mullen <[email protected]>2025-05-25 22:38:44 -0700
committerN. Taylor Mullen <[email protected]>2025-05-25 22:45:53 -0700
commit70d469ccd33c6c3e5f3719f58d5690776098cca4 (patch)
tree1937a7a5a33f148e7e1aebd72c9f6353b33b04a2 /packages/server/src/tools/edit.ts
parent8440b971f5cca47cced8458892f4ec0932745d70 (diff)
Fix(diff): Hide whitespace changes in diffs with content changes
- Updated the diff generation in `edit.ts` and `write-file.ts` to include the `ignoreWhitespace: true` option. - This ensures that whitespace-only changes are not highlighted in the diff output when there are other content modifications, making the diffs cleaner and easier to review. - Extract default diffing options into single source of truth. Fixes https://github.com/google-gemini/gemini-cli/issues/548
Diffstat (limited to 'packages/server/src/tools/edit.ts')
-rw-r--r--packages/server/src/tools/edit.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/server/src/tools/edit.ts b/packages/server/src/tools/edit.ts
index bd070d65..781483ae 100644
--- a/packages/server/src/tools/edit.ts
+++ b/packages/server/src/tools/edit.ts
@@ -22,6 +22,7 @@ import { ReadFileTool } from './read-file.js';
import { GeminiClient } from '../core/client.js';
import { Config } from '../config/config.js';
import { ensureCorrectEdit } from '../utils/editCorrector.js';
+import { DEFAULT_DIFF_OPTIONS } from './diffOptions.js';
/**
* Parameters for the Edit tool
@@ -326,7 +327,7 @@ Expectation for parameters:
newContent,
'Current',
'Proposed',
- { context: 3 },
+ DEFAULT_DIFF_OPTIONS,
);
const confirmationDetails: ToolEditConfirmationDetails = {
type: 'edit',
@@ -408,7 +409,7 @@ Expectation for parameters:
editData.newContent,
'Current',
'Proposed',
- { context: 3 },
+ DEFAULT_DIFF_OPTIONS,
);
displayResult = { fileDiff, fileName };
}