Skip to main content

Module code_diff

Module code_diff 

Source
Expand description

Code diff viewer: a unified patch as reviewable hunks.

Agents propose edits; people review them. CodeDiff shows one file’s patch with old/new line gutters, change tints, a copyable source, and, when reviewable, an Accept / Reject pair per hunk that reports CodeDiffEvents by file path and hunk index. DiffFile::from_unified parses standard unified diffs so the application can hand over what a tool already produced.

The code itself is rendered through the upstream syntax-highlighted, selectable text view; the gutter and change tints are laid out beside it on the same rem-based line height so numbers and lines stay aligned.

Structs§

CodeDiff
One file’s patch as a card: header with path and statistics, then each hunk with gutters, tints, highlighted selectable code, and optional review controls.
DiffFile
One file’s patch.
DiffHunk
A contiguous group of changed lines.
DiffLine
One line of a hunk with its position on either side.
DiffStats
Added and removed line counts.

Enums§

CodeDiffEvent
An interaction emitted by CodeDiff.
DiffLineKind
Whether a line was kept, added, or removed.
HunkReview
The review decision recorded for a hunk.