use correct file when resolving callables
This commit is contained in:
parent
171acad15b
commit
772acb53f2
2 changed files with 14 additions and 4 deletions
|
@ -438,9 +438,10 @@ impl AnalysisImpl {
|
||||||
|
|
||||||
// Resolve the function's NameRef (NOTE: this isn't entirely accurate).
|
// Resolve the function's NameRef (NOTE: this isn't entirely accurate).
|
||||||
let file_symbols = self.index_resolve(name_ref)?;
|
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 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 let Some(descriptor) = FnDescriptor::new(fn_def) {
|
||||||
// If we have a calling expression let's find which argument we are on
|
// If we have a calling expression let's find which argument we are on
|
||||||
let mut current_parameter = None;
|
let mut current_parameter = None;
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
use std::path::{Component, Path, PathBuf};
|
use std::{
|
||||||
|
fmt,
|
||||||
|
path::{Component, Path, PathBuf},
|
||||||
|
};
|
||||||
|
|
||||||
use im;
|
use im;
|
||||||
use ra_analysis::{FileId, FileResolver};
|
use ra_analysis::{FileId, FileResolver};
|
||||||
|
@ -10,7 +13,7 @@ pub enum Root {
|
||||||
Lib,
|
Lib,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
pub struct PathMap {
|
pub struct PathMap {
|
||||||
next_id: u32,
|
next_id: u32,
|
||||||
path2id: im::HashMap<PathBuf, FileId>,
|
path2id: im::HashMap<PathBuf, FileId>,
|
||||||
|
@ -18,6 +21,12 @@ pub struct PathMap {
|
||||||
id2root: im::HashMap<FileId, Root>,
|
id2root: im::HashMap<FileId, Root>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for PathMap {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
f.write_str("PathMap { ... }")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PathMap {
|
impl PathMap {
|
||||||
pub fn new() -> PathMap {
|
pub fn new() -> PathMap {
|
||||||
Default::default()
|
Default::default()
|
||||||
|
|
Loading…
Add table
Reference in a new issue