From ae70d072374f3c4d14abdccbe61661cf02b41b33 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 7 Feb 2020 14:26:59 +0100 Subject: Rename --- crates/ra_ide/src/goto_definition.rs | 4 ++-- crates/ra_ide/src/hover.rs | 4 ++-- crates/ra_ide/src/references.rs | 8 ++++---- crates/ra_ide/src/syntax_highlighting.rs | 20 ++++++++++---------- 4 files changed, 18 insertions(+), 18 deletions(-) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs index 080cc302b..de5551a4c 100644 --- a/crates/ra_ide/src/goto_definition.rs +++ b/crates/ra_ide/src/goto_definition.rs @@ -76,10 +76,10 @@ pub(crate) fn reference_definition( let name_kind = classify_name_ref(sb, name_ref).map(|d| d.kind); match name_kind { Some(Macro(it)) => return Exact(it.to_nav(sb.db)), - Some(Field(it)) => return Exact(it.to_nav(sb.db)), + Some(StructField(it)) => return Exact(it.to_nav(sb.db)), Some(TypeParam(it)) => return Exact(it.to_nav(sb.db)), Some(Local(it)) => return Exact(it.to_nav(sb.db)), - Some(Def(def)) => match NavigationTarget::from_def(sb.db, def) { + Some(ModuleDef(def)) => match NavigationTarget::from_def(sb.db, def) { Some(nav) => return Exact(nav), None => return Approximate(vec![]), }, diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index ab3f513f2..3f88bb260 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs @@ -98,14 +98,14 @@ fn hover_text_from_name_kind(db: &RootDatabase, name_kind: NameKind) -> Option { + StructField(it) => { let src = it.source(db); match src.value { hir::FieldSource::Named(it) => hover_text(it.doc_comment_text(), it.short_label()), _ => None, } } - Def(it) => match it { + ModuleDef(it) => match it { hir::ModuleDef::Module(it) => match it.definition_source(db).value { hir::ModuleSource::Module(it) => { hover_text(it.doc_comment_text(), it.short_label()) diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 612ed84b7..a6320bd2f 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -127,8 +127,8 @@ pub(crate) fn find_all_refs( let declaration = match def.kind { NameKind::Macro(mac) => mac.to_nav(db), - NameKind::Field(field) => field.to_nav(db), - NameKind::Def(def) => NavigationTarget::from_def(db, def)?, + NameKind::StructField(field) => field.to_nav(db), + NameKind::ModuleDef(def) => NavigationTarget::from_def(db, def)?, NameKind::SelfType(imp) => imp.to_nav(db), NameKind::Local(local) => local.to_nav(db), NameKind::TypeParam(_) => return None, @@ -239,7 +239,7 @@ fn decl_access( range: TextRange, ) -> Option { match kind { - NameKind::Local(_) | NameKind::Field(_) => {} + NameKind::Local(_) | NameKind::StructField(_) => {} _ => return None, }; @@ -259,7 +259,7 @@ fn decl_access( fn reference_access(kind: &NameKind, name_ref: &ast::NameRef) -> Option { // Only Locals and Fields have accesses for now. match kind { - NameKind::Local(_) | NameKind::Field(_) => {} + NameKind::Local(_) | NameKind::StructField(_) => {} _ => return None, }; diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index c970f5d34..174e13595 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -320,16 +320,16 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo fn highlight_name(db: &RootDatabase, name_kind: NameKind) -> &'static str { match name_kind { Macro(_) => tags::MACRO, - Field(_) => tags::FIELD, - Def(hir::ModuleDef::Module(_)) => tags::MODULE, - Def(hir::ModuleDef::Function(_)) => tags::FUNCTION, - Def(hir::ModuleDef::Adt(_)) => tags::TYPE, - Def(hir::ModuleDef::EnumVariant(_)) => tags::CONSTANT, - Def(hir::ModuleDef::Const(_)) => tags::CONSTANT, - Def(hir::ModuleDef::Static(_)) => tags::CONSTANT, - Def(hir::ModuleDef::Trait(_)) => tags::TYPE, - Def(hir::ModuleDef::TypeAlias(_)) => tags::TYPE, - Def(hir::ModuleDef::BuiltinType(_)) => tags::TYPE_BUILTIN, + StructField(_) => tags::FIELD, + ModuleDef(hir::ModuleDef::Module(_)) => tags::MODULE, + ModuleDef(hir::ModuleDef::Function(_)) => tags::FUNCTION, + ModuleDef(hir::ModuleDef::Adt(_)) => tags::TYPE, + ModuleDef(hir::ModuleDef::EnumVariant(_)) => tags::CONSTANT, + ModuleDef(hir::ModuleDef::Const(_)) => tags::CONSTANT, + ModuleDef(hir::ModuleDef::Static(_)) => tags::CONSTANT, + ModuleDef(hir::ModuleDef::Trait(_)) => tags::TYPE, + ModuleDef(hir::ModuleDef::TypeAlias(_)) => tags::TYPE, + ModuleDef(hir::ModuleDef::BuiltinType(_)) => tags::TYPE_BUILTIN, SelfType(_) => tags::TYPE_SELF, TypeParam(_) => tags::TYPE_PARAM, Local(local) => { -- cgit v1.2.3