From 772acb53f2d7568ff1cc2ba4ca84a47110f13b3a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 25 Oct 2018 16:25:24 +0300 Subject: use correct file when resolving callables --- crates/ra_analysis/src/imp.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 6c1a4749a..b24b5cfdc 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -438,9 +438,10 @@ impl AnalysisImpl { // Resolve the function's NameRef (NOTE: this isn't entirely accurate). let file_symbols = self.index_resolve(name_ref)?; - for (_, fs) in file_symbols { + for (fn_fiel_id, fs) in file_symbols { if fs.kind == FN_DEF { - if let Some(fn_def) = find_node_at_offset(syntax, fs.node_range.start()) { + let fn_file = self.db.file_syntax(fn_fiel_id); + if let Some(fn_def) = find_node_at_offset(fn_file.syntax(), fs.node_range.start()) { if let Some(descriptor) = FnDescriptor::new(fn_def) { // If we have a calling expression let's find which argument we are on let mut current_parameter = None; -- cgit v1.2.3