From c5868a48795c899d43fde773091f0b133bee0a59 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 15 Oct 2020 17:33:32 +0200 Subject: Clarify the names one more time --- crates/ide/src/doc_links.rs | 4 ++-- crates/ide/src/goto_definition.rs | 4 ++-- crates/ide/src/hover.rs | 4 ++-- crates/ide/src/references.rs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 592a8e3ad..d9dc63b33 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -232,8 +232,8 @@ pub(crate) fn external_docs( let node = token.parent(); let definition = match_ast! { match node { - ast::NameRef(name_ref) => NameRefClass::classify(&sema, &name_ref).map(|d| d.definition(sema.db)), - ast::Name(name) => NameClass::classify(&sema, &name).map(|d| d.reference_or_definition(sema.db)), + ast::NameRef(name_ref) => NameRefClass::classify(&sema, &name_ref).map(|d| d.referenced(sema.db)), + ast::Name(name) => NameClass::classify(&sema, &name).map(|d| d.referenced_or_defined(sema.db)), _ => None, } }; diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index db6ad689e..a87e31019 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 = NameClass::classify(&sema, &name)?.reference_or_definition(sema.db); + let def = NameClass::classify(&sema, &name)?.referenced_or_defined(sema.db); let nav = def.try_to_nav(sema.db)?; vec![nav] }, @@ -83,7 +83,7 @@ pub(crate) fn reference_definition( ) -> ReferenceResult { let name_kind = NameRefClass::classify(sema, name_ref); if let Some(def) = name_kind { - let def = def.definition(sema.db); + let def = def.referenced(sema.db); return match def.try_to_nav(sema.db) { Some(nav) => ReferenceResult::Exact(nav), None => ReferenceResult::Approximate(Vec::new()), diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index e915a753e..845333e2a 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -107,8 +107,8 @@ pub(crate) fn hover( let node = token.parent(); let definition = match_ast! { match node { - ast::Name(name) => NameClass::classify(&sema, &name).and_then(|d| d.definition(sema.db)), - ast::NameRef(name_ref) => NameRefClass::classify(&sema, &name_ref).map(|d| d.definition(sema.db)), + ast::Name(name) => NameClass::classify(&sema, &name).and_then(|d| d.defined(sema.db)), + ast::NameRef(name_ref) => NameRefClass::classify(&sema, &name_ref).map(|d| d.referenced(sema.db)), _ => None, } }; diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index fc537b9c0..67ec257a8 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -132,13 +132,13 @@ fn find_name( opt_name: Option, ) -> Option> { if let Some(name) = opt_name { - let def = NameClass::classify(sema, &name)?.reference_or_definition(sema.db); + let def = NameClass::classify(sema, &name)?.referenced_or_defined(sema.db); let range = name.syntax().text_range(); return Some(RangeInfo::new(range, def)); } let name_ref = sema.find_node_at_offset_with_descend::(&syntax, position.offset)?; - let def = NameRefClass::classify(sema, &name_ref)?.definition(sema.db); + let def = NameRefClass::classify(sema, &name_ref)?.referenced(sema.db); let range = name_ref.syntax().text_range(); Some(RangeInfo::new(range, def)) } -- cgit v1.2.3