Skip to content

Changed Ranges โ€‹

Simple explanation โ€‹

After re-parsing, tools need to know what visually or semantically changed โ€” which lines to repaint, which symbols to re-analyze. Changed ranges answer that as a short list of byte/point spans.

Technical explanation โ€‹

tree/changed_ranges.zig walks old and new trees in lockstep. Structurally equal nodes (same symbol, child count, and points) are descended into; the first divergence on either side emits the new node's range. Equal leaves emit nothing, so identical trees diff to an empty list and insertions diff to a narrow span. A known consequence: same-span text substitutions (e.g. 2 โ†’ 3) change no positions or structure and therefore report no ranges โ€” see Troubleshooting.

Released under the MIT License.