feat: Implement git-style diff viewer in pkg/x/diff#18
Conversation
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>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Adds a new visual side-by-side diff package under
pkg/x/diff.This implements the requirements by adding:
CalculateDiffwhich breaks strings into logicalChangeEqualandChangeDiffsections line-by-line.DiffViewercomponent that loops over diff sections and draws side-by-side cells using a Row, styling changed sections with faint red and green backgrounds.onApplyLeftToRightandonApplyRightToLeftfor their respective panels.pkg/x/diff/diff_test.goto test functionality of the logic.PR created automatically by Jules for task 15107111208349760858 started by @zodimo