From 3ab1519cb27b927074ed7fbbb18a856e6e7fabb8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 23 Jan 2019 23:14:13 +0300 Subject: Change ids strategy this is a part of larghish hir refactoring which aims to * replace per-source-root module trees with per crate trees * switch from a monotyped DedId to type-specific ids --- crates/ra_ide_api/src/goto_definition.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_api/src/goto_definition.rs') diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index b1becca03..323bb1cc1 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs @@ -67,7 +67,7 @@ pub(crate) fn reference_definition( .node_expr(expr) .and_then(|it| infer_result.method_resolution(it)) { - if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)) { + if let Some(target) = NavigationTarget::from_def(db, hir::ModuleDef::Def(def_id)) { return Exact(target); } }; @@ -84,7 +84,7 @@ pub(crate) fn reference_definition( { let resolved = module.resolve_path(db, &path); if let Some(def_id) = resolved.take_types().or(resolved.take_values()) { - if let Some(target) = NavigationTarget::from_def(db, def_id.resolve(db)) { + if let Some(target) = NavigationTarget::from_def(db, def_id) { return Exact(target); } } -- cgit v1.2.3 From 2734636c532101565b1a4c4715790d4cc910ad47 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 24 Jan 2019 15:40:52 +0300 Subject: update ide_api to new hir --- crates/ra_ide_api/src/goto_definition.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'crates/ra_ide_api/src/goto_definition.rs') diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 323bb1cc1..46bdde00d 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs @@ -63,13 +63,11 @@ pub(crate) fn reference_definition( let infer_result = function.infer(db); let syntax_mapping = function.body_syntax_mapping(db); let expr = ast::Expr::cast(method_call.syntax()).unwrap(); - if let Some(def_id) = syntax_mapping + if let Some(func) = syntax_mapping .node_expr(expr) .and_then(|it| infer_result.method_resolution(it)) { - if let Some(target) = NavigationTarget::from_def(db, hir::ModuleDef::Def(def_id)) { - return Exact(target); - } + return Exact(NavigationTarget::from_function(db, func)); }; } } -- cgit v1.2.3