Skip to main content

match_at

Function match_at 

Source
pub fn match_at(
    buffer: &TextBuffer,
    at: Position,
    max_lines: usize,
) -> Option<(Position, Position)>
Expand description

The matching pair for the bracket at, or immediately before, at.

Returns (open, close) in document order regardless of which end was found first, so a caller highlights both without caring which way the scan ran.

Probing both sides of the cursor matters more than it looks: typing ) leaves the caret after it, which is exactly the moment a user wants to see what it closed.