aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/extend_selection.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-21 11:28:58 +0100
committerAleksey Kladov <[email protected]>2019-07-21 11:28:58 +0100
commitd52ee59a712932bc381d8c690dc2f681598760fe (patch)
treef1fd1615203dd5552172cc35e0b6c5c9b76104c2 /crates/ra_ide_api/src/extend_selection.rs
parent62be91b82d6368a20a40893b199bc4f7a35a2223 (diff)
streamline API
Diffstat (limited to 'crates/ra_ide_api/src/extend_selection.rs')
-rw-r--r--crates/ra_ide_api/src/extend_selection.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs
index f78c562af..edbf622c1 100644
--- a/crates/ra_ide_api/src/extend_selection.rs
+++ b/crates/ra_ide_api/src/extend_selection.rs
@@ -1,10 +1,10 @@
1use ra_db::SourceDatabase; 1use ra_db::SourceDatabase;
2use ra_syntax::{ 2use ra_syntax::{
3 algo::{find_covering_element, find_token_at_offset, TokenAtOffset}, 3 algo::find_covering_element,
4 ast::{self, AstNode, AstToken}, 4 ast::{self, AstNode, AstToken},
5 Direction, NodeOrToken, 5 Direction, NodeOrToken,
6 SyntaxKind::*, 6 SyntaxKind::*,
7 SyntaxNode, SyntaxToken, TextRange, TextUnit, T, 7 SyntaxNode, SyntaxToken, TextRange, TextUnit, TokenAtOffset, T,
8}; 8};
9 9
10use crate::{db::RootDatabase, FileRange}; 10use crate::{db::RootDatabase, FileRange};
@@ -34,7 +34,7 @@ fn try_extend_selection(root: &SyntaxNode, range: TextRange) -> Option<TextRange
34 34
35 if range.is_empty() { 35 if range.is_empty() {
36 let offset = range.start(); 36 let offset = range.start();
37 let mut leaves = find_token_at_offset(root, offset); 37 let mut leaves = root.token_at_offset(offset);
38 if leaves.clone().all(|it| it.kind() == WHITESPACE) { 38 if leaves.clone().all(|it| it.kind() == WHITESPACE) {
39 return Some(extend_ws(root, leaves.next()?, offset)); 39 return Some(extend_ws(root, leaves.next()?, offset));
40 } 40 }