Skip to main content

vtcode_core/utils/
diff.rs

1//! Diff utilities for generating structured and formatted diffs.
2//!
3//! Delegates to `vtcode_design::diff` for the canonical implementations.
4
5pub use vtcode_commons::diff::*;
6
7/// Format a unified diff without ANSI color codes.
8pub fn format_unified_diff(old: &str, new: &str, options: DiffOptions<'_>) -> String {
9    vtcode_design::diff::format_unified_diff(old, new, options)
10}
11
12/// Compute a structured diff bundle using the default theme-aware formatter.
13pub fn compute_diff_with_theme(old: &str, new: &str, options: DiffOptions<'_>) -> DiffBundle {
14    vtcode_design::diff::compute_diff_with_theme(old, new, options)
15}
16
17/// Format diff hunks with standard ANSI colors for terminal display.
18pub fn format_colored_diff(hunks: &[DiffHunk], options: &DiffOptions<'_>) -> String {
19    vtcode_design::diff::format_colored_diff(hunks, options)
20}