diff options
Diffstat (limited to 'crates/ra_editor/src/lib.rs')
-rw-r--r-- | crates/ra_editor/src/lib.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/crates/ra_editor/src/lib.rs b/crates/ra_editor/src/lib.rs index b73eb4ac7..02a1b2d45 100644 --- a/crates/ra_editor/src/lib.rs +++ b/crates/ra_editor/src/lib.rs | |||
@@ -8,12 +8,10 @@ extern crate superslice; | |||
8 | extern crate test_utils as _test_utils; | 8 | extern crate test_utils as _test_utils; |
9 | 9 | ||
10 | mod code_actions; | 10 | mod code_actions; |
11 | mod completion; | ||
12 | mod edit; | 11 | mod edit; |
13 | mod extend_selection; | 12 | mod extend_selection; |
14 | mod folding_ranges; | 13 | mod folding_ranges; |
15 | mod line_index; | 14 | mod line_index; |
16 | mod scope; | ||
17 | mod symbols; | 15 | mod symbols; |
18 | #[cfg(test)] | 16 | #[cfg(test)] |
19 | mod test_utils; | 17 | mod test_utils; |
@@ -21,7 +19,6 @@ mod typing; | |||
21 | 19 | ||
22 | pub use self::{ | 20 | pub use self::{ |
23 | code_actions::{add_derive, add_impl, flip_comma, introduce_variable, LocalEdit}, | 21 | code_actions::{add_derive, add_impl, flip_comma, introduce_variable, LocalEdit}, |
24 | completion::{scope_completion, complete_module_items, CompletionItem}, | ||
25 | edit::{Edit, EditBuilder}, | 22 | edit::{Edit, EditBuilder}, |
26 | extend_selection::extend_selection, | 23 | extend_selection::extend_selection, |
27 | folding_ranges::{folding_ranges, Fold, FoldKind}, | 24 | folding_ranges::{folding_ranges, Fold, FoldKind}, |
@@ -33,7 +30,7 @@ pub use ra_syntax::AtomEdit; | |||
33 | use ra_syntax::{ | 30 | use ra_syntax::{ |
34 | algo::find_leaf_at_offset, | 31 | algo::find_leaf_at_offset, |
35 | ast::{self, AstNode, NameOwner}, | 32 | ast::{self, AstNode, NameOwner}, |
36 | File, SmolStr, | 33 | File, |
37 | SyntaxKind::{self, *}, | 34 | SyntaxKind::{self, *}, |
38 | SyntaxNodeRef, TextRange, TextUnit, | 35 | SyntaxNodeRef, TextRange, TextUnit, |
39 | }; | 36 | }; |
@@ -151,15 +148,7 @@ pub fn find_node_at_offset<'a, N: AstNode<'a>>( | |||
151 | leaf.ancestors().filter_map(N::cast).next() | 148 | leaf.ancestors().filter_map(N::cast).next() |
152 | } | 149 | } |
153 | 150 | ||
154 | pub fn resolve_local_name( | 151 | |
155 | name_ref: ast::NameRef, | ||
156 | ) -> Option<(SmolStr, TextRange)> { | ||
157 | let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?; | ||
158 | let scopes = scope::FnScopes::new(fn_def); | ||
159 | let scope_entry = scope::resolve_local_name(name_ref, &scopes)?; | ||
160 | let name = scope_entry.ast().name()?; | ||
161 | Some((scope_entry.name(), name.syntax().range())) | ||
162 | } | ||
163 | 152 | ||
164 | #[cfg(test)] | 153 | #[cfg(test)] |
165 | mod tests { | 154 | mod tests { |