Skip to content

feat: add "hide whitespace changes" option for diffs#2389

Merged
juliusmarminge merged 5 commits intopingdotgg:mainfrom
ipanasenko:hide-whitespace-diff-option
May 3, 2026
Merged

feat: add "hide whitespace changes" option for diffs#2389
juliusmarminge merged 5 commits intopingdotgg:mainfrom
ipanasenko:hide-whitespace-diff-option

Conversation

@ipanasenko
Copy link
Copy Markdown
Contributor

@ipanasenko ipanasenko commented Apr 28, 2026

Hey guys! First of all - I want to tell that I appreciate your work a lot ❤️
Theo's videos, T3 Code, advocating for open source - it's all amazing stuff.

I wanted to contribute this exact thing the moment T3 Code was open sourced, but saw "not accepting contributions" and decided not to.

I'm mostly using Codex App, but I'm trying T3 Code from time to time, curious how you guys improve it every day.
Surprisingly, no "hide whitespaces" feature yet.

I have to say, this is a huuge deal breaker for me, I love reviewing lesser chunks of code, and this is exactly what this feature is for.
Hope this will be useful not just for me, but for other too 🙏

This PR adds "Hide whitespace changes" to Settings and a toogle in diff sidebar:

imageimage

Before/After

Hiding whitespace changes can dramatically simplify reviewing code.

Unified view

imageimage

Split view

imageimage

Note

Add "hide whitespace changes" toggle to diff panel and settings

  • Adds a diffIgnoreWhitespace client setting (default true) that controls whether diffs suppress whitespace-only changes.
  • The diff panel gains a toggle button (PilcrowIcon) that reads from and writes back to this setting, and passes ignoreWhitespace into the checkpoint diff query.
  • diffCheckpoints in CheckpointStore.ts conditionally appends --ignore-all-space to the git diff command when ignoreWhitespace is true.
  • ignoreWhitespace is propagated through the full call chain: contracts → React Query helpers (included in cache key) → getTurnDiff/getFullThreadDiffdiffCheckpoints.
  • Behavioral Change: whitespace changes are hidden by default in all new diffs; callers that don't pass ignoreWhitespace now get true via the ?? true default in CheckpointDiffQuery.ts. CheckpointReactor explicitly passes false to preserve existing behavior.

Macroscope summarized 27d3b21.


Note

Medium Risk
Medium risk because it changes the diff generation contract end-to-end (web query keys/RPC inputs through server git diff invocation), which could affect diff caching and checkpoint diff outputs across clients.

Overview
Adds a new “hide whitespace changes” capability for turn/thread diffs, controlled by a persisted client setting (diffIgnoreWhitespace, defaulting to true) and a DiffPanel toolbar toggle.

Threads the new ignoreWhitespace flag through the diff pipeline (contracts, React Query request + cache keys, server CheckpointDiffQuery, and CheckpointStore.diffCheckpoints), and implements it by conditionally adding git diff --ignore-all-space. Tests are updated/added to assert default behavior and that caches don’t collide across whitespace modes.

Reviewed by Cursor Bugbot for commit 27d3b21. Bugbot is set up for automated code reviews on this repo. Configure here.


Open in Devin Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: de858171-c697-4be1-8c52-d16de6ee72ad

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 28, 2026
@ipanasenko ipanasenko changed the title Add hide whitespace option for diffs feat: add "hide whitespace changes" option for diffs Apr 28, 2026
@ipanasenko ipanasenko marked this pull request as ready for review April 28, 2026 21:57
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp Bot commented Apr 28, 2026

Approvability

Verdict: Approved

This PR adds a straightforward user preference for hiding whitespace changes in diffs. The change is well-scoped, includes comprehensive tests, and only affects diff display formatting. Review comments have been addressed.

You can customize Macroscope's approvability policy. Learn more.

Copy link
Copy Markdown
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default true pls.

Comment thread packages/contracts/src/settings.ts Outdated
autoOpenPlanSidebar: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
confirmThreadArchive: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
confirmThreadDelete: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
diffIgnoreWhitespace: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true by default plsss

Suggested change
diffIgnoreWhitespace: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
diffIgnoreWhitespace: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I also like it true by all the way, decided to keep current behaviour. Same as GitHub.

Pushed default true

const getTurnDiff: CheckpointDiffQueryShape["getTurnDiff"] = Effect.fn("getTurnDiff")(
function* (input) {
const operation = "CheckpointDiffQuery.getTurnDiff";
const ignoreWhitespace = input.ignoreWhitespace ?? false;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const ignoreWhitespace = input.ignoreWhitespace ?? false;
const ignoreWhitespace = input.ignoreWhitespace ?? true;

cwd: tmp,
fromCheckpointRef,
toCheckpointRef,
ignoreWhitespace: false,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ignoreWhitespace: false,
ignoreWhitespace: true,

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Apr 29, 2026
@macroscopeapp macroscopeapp Bot dismissed their stale review May 3, 2026 12:47

Dismissing prior approval to re-evaluate a1c2eaf

@juliusmarminge juliusmarminge merged commit f7748a0 into pingdotgg:main May 3, 2026
12 checks passed
@ipanasenko ipanasenko deleted the hide-whitespace-diff-option branch May 3, 2026 19:15
jimprince pushed a commit to jimprince/t3code that referenced this pull request May 3, 2026
jimprince pushed a commit to jimprince/t3code that referenced this pull request May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants