From fa3c449d8f5a67865cab8d4717b3e32dca5b672a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 15 Oct 2020 16:15:01 +0200 Subject: Clarify NameClass names a bit --- crates/ide/src/doc_links.rs | 2 +- crates/ide/src/goto_definition.rs | 2 +- crates/ide/src/hover.rs | 2 +- crates/ide/src/references.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index db3f911c8..71382f13e 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -233,7 +233,7 @@ pub(crate) fn external_docs( let definition = match_ast! { match node { ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)), - ast::Name(name) => classify_name(&sema, &name).map(|d| d.definition(sema.db)), + ast::Name(name) => classify_name(&sema, &name).map(|d| d.definition_or_reference(sema.db)), _ => None, } }; diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 582bf4837..79fdb75ed 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -40,7 +40,7 @@ pub(crate) fn goto_definition( reference_definition(&sema, &name_ref).to_vec() }, ast::Name(name) => { - let def = classify_name(&sema, &name)?.definition(sema.db); + let def = classify_name(&sema, &name)?.definition_or_reference(sema.db); let nav = def.try_to_nav(sema.db)?; vec![nav] }, diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 632eaf0a0..51f03c718 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -108,7 +108,7 @@ pub(crate) fn hover( let definition = match_ast! { match node { ast::NameRef(name_ref) => classify_name_ref(&sema, &name_ref).map(|d| d.definition(sema.db)), - ast::Name(name) => classify_name(&sema, &name).and_then(|d| d.into_definition(sema.db)), + ast::Name(name) => classify_name(&sema, &name).and_then(|d| d.definition(sema.db)), _ => None, } }; diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index 88e2f2db3..ec64207d2 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -132,7 +132,7 @@ fn find_name( opt_name: Option, ) -> Option> { if let Some(name) = opt_name { - let def = classify_name(sema, &name)?.definition(sema.db); + let def = classify_name(sema, &name)?.definition_or_reference(sema.db); let range = name.syntax().text_range(); return Some(RangeInfo::new(range, def)); } -- cgit v1.2.3