Skip to content

fix(review): hide-whitespace matches GitHub's git diff -w#635

Merged
backnotprop merged 1 commit intomainfrom
fix/hide-whitespace-interior
Apr 30, 2026
Merged

fix(review): hide-whitespace matches GitHub's git diff -w#635
backnotprop merged 1 commit intomainfrom
fix/hide-whitespace-interior

Conversation

@backnotprop
Copy link
Copy Markdown
Owner

Summary

  • Fix: Hide-whitespace was only trimming leading/trailing whitespace per line (via the diff library's ignoreWhitespace), so interior whitespace changes like alignment padding (NODE_ENV: z.enum(...)NODE_ENV: z.enum(...)) and extra spaces between tokens (from 'zod'from 'zod') were still showing as diffs. Now normalizes all whitespace runs to a single space before diffing, matching GitHub's ?w=1 / git diff -w behavior.
  • Demo: Adds a real code change (pool.max: 5 → 10) to the settings.ts demo file so it's not fully collapsed when hide-whitespace is on — demonstrates the feature clearly.

Test plan

  • Open review dev server (bun run dev:review)
  • Select src/config/settings.ts in the file tree
  • Verify without hide-whitespace: all alignment, indentation, and pool max changes visible
  • Toggle hide-whitespace on: only the max: ... ? 20 : 510 change should remain
  • Verify other demo files (Button.tsx, api.ts, Modal.tsx) render correctly with hide-whitespace on/off

… GitHub

The diff library's ignoreWhitespace only trims leading/trailing whitespace,
so interior changes (alignment padding, extra spaces between tokens) still
showed as diffs. Normalize all whitespace before diffing to match git diff -w.

Also adds a real code change to the settings.ts demo so the file isn't fully
collapsed when hide-whitespace is on.
@backnotprop backnotprop merged commit c1f5a77 into main Apr 30, 2026
4 checks passed
@backnotprop backnotprop deleted the fix/hide-whitespace-interior branch April 30, 2026 18:04
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.

1 participant