hn.today

Show HN: CodeDiff – Fast (<100ms), robust (99.95%) syntax-aware code diff

github.com7 points1 comments
Screenshot of Show HN: CodeDiff – Fast (<100ms), robust (99.95%) syntax-aware code diff

CodeDiff is a Rust-based syntax-aware diff tool that emphasizes speed, robustness, and precision for source-code changes. It uses tree-sitter grammars to produce fine-grained, semantic hunks (detecting moved code, partial-line edits, and enclosing function/class context) rather than whole-line churn. Performance claims include under 100 ms for 93% of changes and the ability to diff 99.95% of changes; accuracy metrics report 70% of diffs as perfect and 90% near-perfect. It supports 24 languages with text and binary fallbacks, presents changes in a two-pane terminal UI with 24-bit color when available, and includes a browser demo showing side-by-side comparisons with GNU diff.

Distribution and integration are comprehensive: build from source via cargo or install prebuilt binaries for Linux, macOS, and Windows; Homebrew, Debian/Ubuntu apt repo, Nix, Arch and Gentoo packaging are available. Usage modes include an interactive TUI, headless/batch output for CI, and structured JSON output for editor tooling (rows/columns are byte offsets, hunks carry operation types and reference lines). Git integration is provided (difftool backend and GIT_EXTERNAL_DIFF), and editor plugins exist or are planned (VS Code extension awaiting API, Neovim plugin). Headless defaults, color controls, context collapsing, and exit-code behavior are designed for scripting and VCS workflows.

Read on github.com1 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.