Repository navigation
feat: add "hide whitespace changes" option for diffs #2389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
juliusmarminge
merged 5 commits into
pingdotgg:main
from
ipanasenko:hide-whitespace-diff-option
May 3, 2026
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e8307de
Add hide whitespace option for diffs
3c726e4
default to true + test
6d9a2ba
Merge branch 'main' into hide-whitespace-diff-option
ipanasenko a1c2eaf
Merge branch 'main' into hide-whitespace-diff-option
ipanasenko 27d3b21
fix merge
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -111,12 +111,88 @@ it.layer(TestLayer)("CheckpointStoreLive", (it) => { | |||||
| cwd: tmp, | ||||||
| fromCheckpointRef, | ||||||
| toCheckpointRef, | ||||||
| ignoreWhitespace: false, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }); | ||||||
|
|
||||||
| expect(diff).toContain("diff --git"); | ||||||
| expect(diff).not.toContain("[truncated]"); | ||||||
| expect(diff).toContain("+line 04999"); | ||||||
| }), | ||||||
| ); | ||||||
|
|
||||||
| it.effect("can hide indentation churn when changes wrap existing lines", () => | ||||||
| Effect.gen(function* () { | ||||||
| const tmp = yield* makeTmpDir(); | ||||||
| yield* initRepoWithCommit(tmp); | ||||||
| const checkpointStore = yield* CheckpointStore; | ||||||
| const threadId = ThreadId.make("thread-checkpoint-store-whitespace"); | ||||||
| const fromCheckpointRef = checkpointRefForThreadTurn(threadId, 0); | ||||||
| const toCheckpointRef = checkpointRefForThreadTurn(threadId, 1); | ||||||
|
|
||||||
| const componentPath = path.join(tmp, "Component.tsx"); | ||||||
| yield* writeTextFile( | ||||||
| componentPath, | ||||||
| [ | ||||||
| "export function View() {", | ||||||
| " return (", | ||||||
| " <section>", | ||||||
| " <h1>Title</h1>", | ||||||
| " <p>Body</p>", | ||||||
| " </section>", | ||||||
| " );", | ||||||
| "}", | ||||||
| "", | ||||||
| ].join("\n"), | ||||||
| ); | ||||||
| yield* checkpointStore.captureCheckpoint({ | ||||||
| cwd: tmp, | ||||||
| checkpointRef: fromCheckpointRef, | ||||||
| }); | ||||||
| yield* writeTextFile( | ||||||
| componentPath, | ||||||
| [ | ||||||
| "export function View() {", | ||||||
| " return (", | ||||||
| " <section>", | ||||||
| " {isReady ? (", | ||||||
| " <div>", | ||||||
| " <h1>Title</h1>", | ||||||
| " <p>Body</p>", | ||||||
| " </div>", | ||||||
| " ) : null}", | ||||||
| " </section>", | ||||||
| " );", | ||||||
| "}", | ||||||
| "", | ||||||
| ].join("\n"), | ||||||
| ); | ||||||
| yield* checkpointStore.captureCheckpoint({ | ||||||
| cwd: tmp, | ||||||
| checkpointRef: toCheckpointRef, | ||||||
| }); | ||||||
|
|
||||||
| const normalDiff = yield* checkpointStore.diffCheckpoints({ | ||||||
| cwd: tmp, | ||||||
| fromCheckpointRef, | ||||||
| toCheckpointRef, | ||||||
| ignoreWhitespace: false, | ||||||
| }); | ||||||
| const whitespaceIgnoredDiff = yield* checkpointStore.diffCheckpoints({ | ||||||
| cwd: tmp, | ||||||
| fromCheckpointRef, | ||||||
| toCheckpointRef, | ||||||
| ignoreWhitespace: true, | ||||||
| }); | ||||||
|
|
||||||
| expect(normalDiff).toContain("diff --git"); | ||||||
| expect(normalDiff).toContain("- <h1>Title</h1>"); | ||||||
| expect(normalDiff).toContain("+ <h1>Title</h1>"); | ||||||
| expect(whitespaceIgnoredDiff).toContain("diff --git"); | ||||||
| expect(whitespaceIgnoredDiff).toContain("+ {isReady ? ("); | ||||||
| expect(whitespaceIgnoredDiff).toContain("+ <div>"); | ||||||
| expect(whitespaceIgnoredDiff).not.toContain("- <h1>Title</h1>"); | ||||||
| expect(whitespaceIgnoredDiff).not.toContain("+ <h1>Title</h1>"); | ||||||
| }), | ||||||
| ); | ||||||
| }); | ||||||
| }); | ||||||
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.