expand_selection to current node with no children (#1454)

pull/1465/head
Michael Davis 3 years ago committed by GitHub
parent 5b45bdd80f
commit 939261fc07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,7 +12,7 @@ pub fn expand_selection(syntax: &Syntax, text: RopeSlice, selection: &Selection)
.root_node() .root_node()
.descendant_for_byte_range(from, to) .descendant_for_byte_range(from, to)
.and_then(|node| { .and_then(|node| {
if node.child_count() == 0 || (node.start_byte() == from && node.end_byte() == to) { if node.start_byte() == from && node.end_byte() == to {
node.parent() node.parent()
} else { } else {
Some(node) Some(node)

Loading…
Cancel
Save