Skip to content

Semantic Comparison Pro

Pro feature

This feature requires a Pro licence. Activate your licence to unlock it.

What semantic comparison does

Standard line-based comparison treats every changed character as significant. Semantic comparison parses each file into its abstract syntax tree and compares the tree structure instead of raw lines. Pure formatting changes - reindenting a block, reformatting a function signature, adding or removing blank lines - produce no highlighted changes. Only changes to actual code logic, identifiers, or values are shown.

When to use it

  • After running a code formatter or linter that changed indentation or brace style across many files.
  • When reviewing a refactor where functions were moved but their bodies were unchanged.
  • Any time a line-based comparison is obscured by noise from formatting-only changes.

Activating semantic mode

  1. Open a file comparison with a supported source file on both sides.
  2. In the algorithm selector toolbar, click Semantic.
  3. The comparison re-runs and formatting-only changes disappear from the view.

Supported languages

Semantic parsing is available for: C, C++, Dart, Go, Java, JavaScript, Python, Rust, TypeScript.

Large files

Semantic diff uses an algorithm whose cost grows with the number of AST nodes in both files. For very large files Diffract will show a warning before running the comparison and ask whether to continue with semantic diff or switch to Histogram. You can also bypass this check entirely from the CLI with --no-size-limit.

Interpreting the result

  • Lines highlighted in the semantic view represent genuine logic changes.
  • Lines that changed formatting only are shown as identical (white background).
  • Word-level highlighting still applies within changed lines.