Skip to content

feat: Implement git-style diff viewer in pkg/x/diff#18

Open
zodimo wants to merge 1 commit intomainfrom
add-pkg-diff-viewer-15107111208349760858
Open

feat: Implement git-style diff viewer in pkg/x/diff#18
zodimo wants to merge 1 commit intomainfrom
add-pkg-diff-viewer-15107111208349760858

Conversation

@zodimo
Copy link
Owner

@zodimo zodimo commented Mar 25, 2026

Adds a new visual side-by-side diff package under pkg/x/diff.

This implements the requirements by adding:

  1. CalculateDiff which breaks strings into logical ChangeEqual and ChangeDiff sections line-by-line.
  2. DiffViewer component that loops over diff sections and draws side-by-side cells using a Row, styling changed sections with faint red and green backgrounds.
  3. Apply buttons that properly dispatch onApplyLeftToRight and onApplyRightToLeft for their respective panels.
  4. Unit tests inside pkg/x/diff/diff_test.go to test functionality of the logic.

PR created automatically by Jules for task 15107111208349760858 started by @zodimo

Adds a new package `pkg/x/diff` that calculates string diffs using
github.com/sergi/go-diff/diffmatchpatch, groups line operations,
and provides a composable DiffViewer for rendering the original and
modified text side-by-side with appropriate background colors. Includes
action buttons mapped to user-provided callback functions to support
applying differences right-to-left or left-to-right on a per-section
basis. Also includes unit tests for the diff calculation logic.

Co-authored-by: zodimo <5030404+zodimo@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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