@@ -1,6 +1,6 @@
1use crate::{Range, Rope, Selection, Syntax};
1use crate::{Range, Rope, Selection, Syntax};
3−// const PAIRS: &[(char, char)] = &[('(', ')'), ('{', '}'), ('[', ']')];
3+const PAIRS: &[(char, char)] = &[('(', ')'), ('{', '}'), ('[', ']'), ('<', '>')];
4// limit matching pairs to only ( ) { } [ ] < >
4// limit matching pairs to only ( ) { } [ ] < >
@@ -20,15 +20,21 @@ pub fn find(syntax: &Syntax, doc: &Rope, pos: usize) -> Option<usize> {
20 None => return None,
20 None => return None,
23 let start_byte = node.start_byte();
27 let start_byte = node.start_byte();
24 let end_byte = node.end_byte() - 1; // it's end exclusive
28 let end_byte = node.end_byte() - 1; // it's end exclusive
30+ if PAIRS.contains(&(doc.char(start_byte), doc.char(end_byte))) {
26− if start_byte == byte_pos {
31+ if start_byte == byte_pos {
27− return Some(doc.byte_to_char(end_byte));
32+ return Some(doc.byte_to_char(end_byte));
30− if end_byte == byte_pos {
35+ if end_byte == byte_pos {
31− return Some(doc.byte_to_char(start_byte));
36+ return Some(doc.byte_to_char(start_byte));