Skip to main content

matching_bracket_text

Function matching_bracket_text 

Source
pub fn matching_bracket_text(
    rope: &Rope,
    pos: usize,
    pairs: &[(String, String)],
) -> Option<(usize, usize)>
Expand description

The bracket pair at pos found by scanning the text: when the char before pos (or at it) is a bracket from pairs, returns the positions of it and its partner, opening first. Brackets inside strings and comments are counted too; frontends with a syntax tree use the tree’s answer instead.