diff options
Diffstat (limited to 'crates/ra_analysis/src/completion')
-rw-r--r-- | crates/ra_analysis/src/completion/reference_completion.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_analysis/src/completion/reference_completion.rs b/crates/ra_analysis/src/completion/reference_completion.rs index a0af59178..858b52e76 100644 --- a/crates/ra_analysis/src/completion/reference_completion.rs +++ b/crates/ra_analysis/src/completion/reference_completion.rs | |||
@@ -13,6 +13,7 @@ use crate::{ | |||
13 | descriptors::{ | 13 | descriptors::{ |
14 | module::{ModuleDescriptor}, | 14 | module::{ModuleDescriptor}, |
15 | function::FnScopes, | 15 | function::FnScopes, |
16 | Def, | ||
16 | Path, | 17 | Path, |
17 | }, | 18 | }, |
18 | Cancelable | 19 | Cancelable |
@@ -156,10 +157,14 @@ fn complete_path( | |||
156 | return Ok(()); | 157 | return Ok(()); |
157 | } | 158 | } |
158 | path.segments.pop(); | 159 | path.segments.pop(); |
159 | let target_module = match module.resolve_path(db, path)? { | 160 | let def_id = match module.resolve_path(db, path)? { |
160 | None => return Ok(()), | 161 | None => return Ok(()), |
161 | Some(it) => it, | 162 | Some(it) => it, |
162 | }; | 163 | }; |
164 | let target_module = match def_id.resolve(db)? { | ||
165 | Def::Module(it) => it, | ||
166 | Def::Item => return Ok(()), | ||
167 | }; | ||
163 | let module_scope = target_module.scope(db)?; | 168 | let module_scope = target_module.scope(db)?; |
164 | let completions = module_scope.entries().map(|(name, _res)| CompletionItem { | 169 | let completions = module_scope.entries().map(|(name, _res)| CompletionItem { |
165 | label: name.to_string(), | 170 | label: name.to_string(), |