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.

Cross-language comparison

When the two sides are different supported languages (for example a Python file on the left and a Dart file on the right), Diffract aligns functions and control-flow constructs, which are normalised into a shared form across languages. A function renamed or re-expressed with an equivalent control-flow shape (a for rewritten as a while, a ternary rewritten as an if/else) is still matched.

Variable initializers are language-dependent and are not normalised across languages, so differences in how values are declared or initialised may still appear as changes even when the intent is the same.

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.