Skip to main content

expand_byte_range_to_blocks

Function expand_byte_range_to_blocks 

Source
pub fn expand_byte_range_to_blocks(
    tree: &SyntaxNode,
    start: usize,
    end: usize,
) -> (usize, usize)
Expand description

Expand a byte range to encompass complete block-level elements (internal helper).

This ensures that formatting doesn’t split blocks mid-content and that context-dependent formatting (lists, blockquotes) works correctly.

§Arguments

  • tree - The syntax tree root
  • start - Starting byte offset (inclusive)
  • end - Ending byte offset (exclusive)

§Returns

Expanded byte range (start, end) that covers complete blocks