diff options
| author | Taylor Mullen <[email protected]> | 2025-05-25 22:38:44 -0700 |
|---|---|---|
| committer | N. Taylor Mullen <[email protected]> | 2025-05-25 22:45:53 -0700 |
| commit | 70d469ccd33c6c3e5f3719f58d5690776098cca4 (patch) | |
| tree | 1937a7a5a33f148e7e1aebd72c9f6353b33b04a2 /packages/server/src/tools/diffOptions.ts | |
| parent | 8440b971f5cca47cced8458892f4ec0932745d70 (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/diffOptions.ts')
| -rw-r--r-- | packages/server/src/tools/diffOptions.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/server/src/tools/diffOptions.ts b/packages/server/src/tools/diffOptions.ts new file mode 100644 index 00000000..598b46f1 --- /dev/null +++ b/packages/server/src/tools/diffOptions.ts @@ -0,0 +1,12 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import * as Diff from 'diff'; + +export const DEFAULT_DIFF_OPTIONS: Diff.PatchOptions = { + context: 3, + ignoreWhitespace: true, +}; |
