restore index-based gotodef

This commit is contained in:
Aleksey Kladov 2018-12-05 12:17:38 +03:00
parent 84f2509730
commit 7960c8b276
2 changed files with 21 additions and 5 deletions

View file

@ -214,7 +214,7 @@ impl AnalysisImpl {
{
let scope = fn_descr.scope(&*self.db);
// First try to resolve the symbol locally
return if let Some(entry) = scope.resolve_local_name(name_ref) {
if let Some(entry) = scope.resolve_local_name(name_ref) {
let mut vec = vec![];
vec.push((
position.file_id,
@ -224,12 +224,11 @@ impl AnalysisImpl {
kind: NAME,
},
));
Ok(vec)
} else {
// If that fails try the index based approach.
self.index_resolve(name_ref)
return Ok(vec);
};
}
// If that fails try the index based approach.
return self.index_resolve(name_ref);
}
if let Some(name) = find_node_at_offset::<ast::Name>(syntax, position.offset) {
if let Some(module) = name.syntax().parent().and_then(ast::Module::cast) {