Expand description
Turning a formatter’s whole-file output into a minimal edit set.
A formatter returns a new file, not a patch. Splicing that over the buffer would be the obvious implementation and the wrong one: it destroys cursor position, marks and folds, invalidates every renderer fast path, and shows as a full-viewport repaint — a UX veto even when the visible text is unchanged.
lattice-diff already computes line-granular hunks for the diff
subsystem, and line granularity is the right resolution here: a
formatter’s unit of change is the line.
Functions§
- changes_
more_ than_ indentation - Whether
newdiffers fromoldin more than leading whitespace. - minimal_
edits - Edits that transform
oldintonew, one per changed region.