Function biome_formatter::format_range
source · pub fn format_range<Language: FormatLanguage>(
root: &SyntaxNode<Language::SyntaxLanguage>,
range: TextRange,
language: Language
) -> FormatResult<Printed>
Expand description
Formats a range within a file, supported by Biome
This runs a simple heuristic to determine the initial indentation level of the node based on the provided FormatContext, which must match currently the current initial of the file. Additionally, because the reformatting happens only locally the resulting code will be indented with the same level as the original selection, even if it’s a mismatch from the rest of the block the selection is in
It returns a Formatted result with a range corresponding to the range of the input that was effectively overwritten by the formatter