Expand description
Edit-producing formatting.
Instead of returning a fully rebuilt string, these helpers diff the source against the formatted output and return the minimal replacement(s). Minimal edits keep the editor cursor stable, compose with other edits (e.g. lint fixes), and enable range formatting.
Structs§
- Text
Edit - A single text replacement against the original source offsets.
Functions§
- diff_
edits - Computes the minimal edit(s) turning
sourceintoformatted. - format_
edits - Formats
sourceand returns the minimal edit(s) to apply. - format_
range - Like
format_edits, but only returns edits intersectingrange.