@@ -2,12 +2,11 @@ use crate::{Range, RopeSlice, Selection, Syntax};
2use tree_sitter::Node;
2use tree_sitter::Node;
4pub fn expand_selection(syntax: &Syntax, text: RopeSlice, selection: Selection) -> Selection {
4pub fn expand_selection(syntax: &Syntax, text: RopeSlice, selection: Selection) -> Selection {
5− select_node_impl(syntax, text, selection, |descendant, from, to| {
5+ select_node_impl(syntax, text, selection, |mut node, from, to| {
6− if descendant.start_byte() == from && descendant.end_byte() == to {
6+ while node.start_byte() == from && node.end_byte() == to {
7− descendant.parent()
7+ node = node.parent()?;