aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/extend_selection.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs
index 2e09bd1ec..f5a063351 100644
--- a/crates/ra_ide/src/extend_selection.rs
+++ b/crates/ra_ide/src/extend_selection.rs
@@ -161,7 +161,7 @@ fn extend_tokens_from_range(
161 .take_while(validate) 161 .take_while(validate)
162 .last()?; 162 .last()?;
163 163
164 let range = union_range(first.text_range(), last.text_range()); 164 let range = first.text_range().extend_to(&last.text_range());
165 if original_range.is_subrange(&range) && original_range != range { 165 if original_range.is_subrange(&range) && original_range != range {
166 Some(range) 166 Some(range)
167 } else { 167 } else {
@@ -169,12 +169,6 @@ fn extend_tokens_from_range(
169 } 169 }
170} 170}
171 171
172fn union_range(range: TextRange, r: TextRange) -> TextRange {
173 let start = range.start().min(r.start());
174 let end = range.end().max(r.end());
175 TextRange::from_to(start, end)
176}
177
178/// Find the shallowest node with same range, which allows us to traverse siblings. 172/// Find the shallowest node with same range, which allows us to traverse siblings.
179fn shallowest_node(node: &SyntaxNode) -> SyntaxNode { 173fn shallowest_node(node: &SyntaxNode) -> SyntaxNode {
180 node.ancestors().take_while(|n| n.text_range() == node.text_range()).last().unwrap() 174 node.ancestors().take_while(|n| n.text_range() == node.text_range()).last().unwrap()