Skip to main content

annotate_diff

Function annotate_diff 

Source
pub fn annotate_diff(diff_text: &str) -> Option<String>
Expand description

Annotate a unified diff with content-source markers.

Transforms a standard unified diff into a human-readable annotated format that shows the source of each line:

  • [agent] — context lines (unchanged content from agent)
  • [user+] — lines added by the user
  • [user-] — lines removed by the user
  • [user~] — lines modified by the user (paired add/remove with >60% common prefix)

Returns the annotated diff as a string, or None if the diff is empty.