Skip to content

feat(code): add hide whitespace changes toggle to diff viewer#1385

Merged
k11kirky merged 3 commits intomainfrom
feat/hide-whitespace-diff
Mar 31, 2026
Merged

feat(code): add hide whitespace changes toggle to diff viewer#1385
k11kirky merged 3 commits intomainfrom
feat/hide-whitespace-diff

Conversation

@richardsolomou
Copy link
Copy Markdown
Member

Problem

When reviewing diffs with formatting or indentation changes, the meaningful code changes get obscured by whitespace noise. There's no way to filter these out in the diff viewer.

Changes

Adds a "Hide whitespace changes" toggle to the diff viewer's ... dropdown menu (alongside existing options like split/unified, word wrap, word diffs). When enabled, whitespace-only differences are filtered out using a custom override of @codemirror/merge's diff algorithm — similar to git diff -w.

  • diffViewerStore.ts — New hideWhitespaceChanges persisted state + toggle action
  • useCodeMirror.tswhitespaceIgnoringDiff function that runs the default diff then filters out changes where stripping all whitespace yields identical text; wired via diffConfig.override
  • CodeMirrorDiffEditor.tsx — New dropdown menu item, passes option through to hook

How did you test this?

  • Verified no type errors in changed files (tsc --noEmit)
  • All 370 existing unit tests pass
  • Lint/format passes via pre-commit hook

Adds a "Hide whitespace changes" option to the diff viewer dropdown
menu. When enabled, whitespace-only differences are filtered out of
the diff using a custom override of the @codemirror/merge diff
algorithm, similar to git diff -w.
@richardsolomou richardsolomou requested a review from a team March 31, 2026 10:39
@k11kirky
Copy link
Copy Markdown
Contributor

@richardsolomou there was another PR in this area this morning - let me know if the prior pr fixed this or you still want a review. if so please fix conflict <3

@richardsolomou
Copy link
Copy Markdown
Member Author

@richardsolomou there was another PR in this area this morning - let me know if the prior pr fixed this or you still want a review. if so please fix conflict <3

@k11kirky Yep, collapse/expand unchanged lines and hiding/showing whitespace diffs are the most perfectly and accidentally complementary features ever. Conflict fixed!

@k11kirky k11kirky merged commit 663966a into main Mar 31, 2026
15 checks passed
@k11kirky k11kirky deleted the feat/hide-whitespace-diff branch March 31, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants