Skip to content

Commit

Permalink
make TS matching fallback to plaintext
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalkuthe committed Jun 6, 2023
1 parent f5a3f99 commit 96710ed
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion helix-core/src/match_brackets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ fn find_pair(
node = parent;
}
let node = tree.root_node().named_descendant_for_byte_range(pos, pos)?;
if node.child_count() != 0 {
return None;
}
let node_start = doc.byte_to_char(node.start_byte());
find_matching_bracket_plaintext(doc.byte_slice(node.byte_range()), pos_ - node_start)
.map(|pos| pos + node_start)
Expand Down Expand Up @@ -248,7 +251,7 @@ fn as_open_pair(doc: RopeSlice, node: &Node) -> Option<char> {
.find_map(|&(open, close_)| (close_ == close).then_some(open))
}

/// Tests if this node is a pair opening and returns the expected close char
/// If node is a single char return it (and its char position)
fn as_char(doc: RopeSlice, node: &Node) -> Option<(usize, char)> {
// TODO: multi char/non ASCII pairs
if node.byte_range().len() != 1 {
Expand Down

0 comments on commit 96710ed

Please sign in to comment.