expand_selection to current node with no children (#1454)
This commit is contained in:
parent
5b45bdd80f
commit
939261fc07
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue