Skip to main content

Module edits

Module edits 

Source
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§

TextEdit
A single text replacement against the original source offsets.

Functions§

diff_edits
Computes the minimal edit(s) turning source into formatted.
format_edits
Formats source and returns the minimal edit(s) to apply.
format_range
Like format_edits, but only returns edits intersecting range.