diff options
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 6dadc059f..ad4b40c58 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -20,9 +20,10 @@ use crate::{ | |||
20 | completion::{completions, CompletionItem}, | 20 | completion::{completions, CompletionItem}, |
21 | db::{self, FileSyntaxQuery, SyntaxDatabase}, | 21 | db::{self, FileSyntaxQuery, SyntaxDatabase}, |
22 | hir::{ | 22 | hir::{ |
23 | function::{FnDescriptor, FnId}, | 23 | FunctionDescriptor, ModuleDescriptor, |
24 | module::{ModuleDescriptor, Problem}, | 24 | function::FnDescriptor, |
25 | DeclarationDescriptor, HirDatabase, | 25 | module::{Problem}, |
26 | DeclarationDescriptor, | ||
26 | }, | 27 | }, |
27 | input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE}, | 28 | input::{FilesDatabase, SourceRoot, SourceRootId, WORKSPACE}, |
28 | symbol_index::SymbolIndex, | 29 | symbol_index::SymbolIndex, |
@@ -587,8 +588,8 @@ fn resolve_local_name( | |||
587 | name_ref: ast::NameRef, | 588 | name_ref: ast::NameRef, |
588 | ) -> Option<(SmolStr, TextRange)> { | 589 | ) -> Option<(SmolStr, TextRange)> { |
589 | let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?; | 590 | let fn_def = name_ref.syntax().ancestors().find_map(ast::FnDef::cast)?; |
590 | let fn_id = FnId::get(db, file_id, fn_def); | 591 | let function = FunctionDescriptor::guess_from_source(db, file_id, fn_def); |
591 | let scopes = db.fn_scopes(fn_id); | 592 | let scopes = function.scope(db); |
592 | let scope_entry = crate::hir::function::resolve_local_name(name_ref, &scopes)?; | 593 | let scope_entry = crate::hir::function::resolve_local_name(name_ref, &scopes)?; |
593 | let syntax = db.resolve_syntax_ptr(scope_entry.ptr().into_global(file_id)); | 594 | let syntax = db.resolve_syntax_ptr(scope_entry.ptr().into_global(file_id)); |
594 | Some((scope_entry.name().clone(), syntax.range())) | 595 | Some((scope_entry.name().clone(), syntax.range())) |