Text of ex-ast.hexdocs.pm › ExAST.Diff.html as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

ExAST.Diff — ExAST v0.16.0

ExAST. Diff (ExAST v0.16.0) Copy Markdown View Source Syntax-aware diffing for Elixir source code. Parses two source strings with Sourceror, maps structurally similar AST nodes, and produces a diff result with insert, delete, update, and move edits. Summary Types option() Functions apply(result) Applies a diff result to the left source, producing the patched output. diff(left_source, right_source, opts \\ []) diff_files(left_path, right_path, opts \\ []) Types option() @type option() :: {:include_moves, boolean ()} Functions apply(result) @spec apply( ExAST.Diff.Result.t ()) :: String.t () Applies a diff result to the left source, producing the patched output.

Updates and deletes are applied via range replacement. Inserts are placed at the resolved insertion point based on sibling/parent context. Move edits are skipped (content unchanged, only order differs). diff(left_source, right_source, opts \\ []) @spec diff( String.t (), String.t (), [ option ()]) :: ExAST.Diff.Result.t () diff_files(left_path, right_path, opts \\ []) @spec diff_files( String.t (), String.t (), [ option ()]) :: ExAST.Diff.Result.t ()