Skip to main content

Crate omnidiff

Crate omnidiff 

Source
Expand description

Syntax-aware code diffing on tree-sitter ASTs.

diff_strings is the entry point: it parses both sides into code::Code and returns a diff::Diff: the mapping between the two syntax trees plus the changed text ranges it implies. The tui feature adds the terminal viewer built on it.

§Stability

This crate is published for the omnidiff binary. Its stable contracts are the command line and the --mode json output, which the editor integrations consume. The library API - the diff module’s submodules (apted, cost, nodes, text, text_range), the tui module, and the tree_sitter and ratatui types in their signatures - is the binary’s internals made visible, and changes between 0.x minor versions without notice. diff_strings and the code and diff module roots are the parts meant for use from another crate.

Modules§

code
One side of a diff: Code holds the source text and what is derived from it - the tree-sitter AST, the detected Language, and per-node ASTMetadata (hashes, depths, parents) that the diff passes read. Code::from_string parses; language maps file names to languages and languages to grammars.
diff
Matching two syntax trees, and the text ranges that matching implies.
review
Git commit review: what a repository has pending (unstaged), staged, and recently committed, and how to turn any one of those changes into the two files on disk the diff engine reads. The TUI’s review picker (tui::components::review_dialog) is its caller.
tui

Functions§

diff_strings
Diffs two programs given as source strings in language.