diff options
author | Aleksey Kladov <[email protected]> | 2019-07-21 11:28:58 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-21 11:28:58 +0100 |
commit | d52ee59a712932bc381d8c690dc2f681598760fe (patch) | |
tree | f1fd1615203dd5552172cc35e0b6c5c9b76104c2 /crates/ra_ide_api/src/extend_selection.rs | |
parent | 62be91b82d6368a20a40893b199bc4f7a35a2223 (diff) |
streamline API
Diffstat (limited to 'crates/ra_ide_api/src/extend_selection.rs')
-rw-r--r-- | crates/ra_ide_api/src/extend_selection.rs | 6 |
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 @@ | |||
1 | use ra_db::SourceDatabase; | 1 | use ra_db::SourceDatabase; |
2 | use ra_syntax::{ | 2 | use 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 | ||
10 | use crate::{db::RootDatabase, FileRange}; | 10 | use 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 | } |