feat(code): add hide whitespace changes toggle to diff viewer#1385
Merged
feat(code): add hide whitespace changes toggle to diff viewer#1385
Conversation
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.
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 |
Member
Author
@k11kirky Yep, collapse/expand unchanged lines and hiding/showing whitespace diffs are the most perfectly and accidentally complementary features ever. Conflict fixed! |
k11kirky
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 togit diff -w.diffViewerStore.ts— NewhideWhitespaceChangespersisted state + toggle actionuseCodeMirror.ts—whitespaceIgnoringDifffunction that runs the default diff then filters out changes where stripping all whitespace yields identical text; wired viadiffConfig.overrideCodeMirrorDiffEditor.tsx— New dropdown menu item, passes option through to hookHow did you test this?
tsc --noEmit)