From 19e28888aa41b2845b47adb7314aed99d3c48679 Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Fri, 1 May 2020 16:26:22 +0200 Subject: wip Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- crates/ra_ide_db/src/defs.rs | 8 +++++++- crates/ra_ide_db/src/marks.rs | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'crates/ra_ide_db') diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 7cd2384e9..54543e6e4 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -11,7 +11,7 @@ use hir::{ }; use ra_prof::profile; use ra_syntax::{ - ast::{self, AstNode}, + ast::{self, AstNode, NameOwner}, match_ast, }; use test_utils::tested_by; @@ -115,10 +115,16 @@ pub fn classify_name(sema: &Semantics, name: &ast::Name) -> Option } fn classify_name_inner(sema: &Semantics, name: &ast::Name) -> Option { + println!("name : {} -- {:?}", name, name); let parent = name.syntax().parent()?; + println!("parent : {} -- {:?}", parent, parent); match_ast! { match parent { + ast::Alias(it) => { + let def = sema.to_def(&it)?; + Some(Definition::ModuleDef(def.into())) + }, ast::BindPat(it) => { let local = sema.to_def(&it)?; Some(Definition::Local(local)) diff --git a/crates/ra_ide_db/src/marks.rs b/crates/ra_ide_db/src/marks.rs index 03b4be21c..386fe605c 100644 --- a/crates/ra_ide_db/src/marks.rs +++ b/crates/ra_ide_db/src/marks.rs @@ -2,6 +2,7 @@ test_utils::marks![ goto_def_for_macros + goto_def_for_use_alias goto_def_for_methods goto_def_for_fields goto_def_for_record_fields -- cgit v1.2.3