Skip to main content

format_range

Function format_range 

Source
pub fn format_range(
    source: &str,
    target: Range<usize>,
    options: &FormatOptions,
) -> Option<RangeEdit>
Expand description

Reformat only the top-level statements intersecting target (byte offsets into source), leaving the rest of the document unchanged.

Returns None when nothing should change: the source cannot be parsed cleanly (same conservative contract as crate::format), the range touches no statement, or the selection is already formatted.