From da401495722ca43b60834399208e822dbbadd06d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Feb 2020 15:03:09 +0100 Subject: Fix union classification --- crates/ra_ide/src/syntax_highlighting.rs | 2 +- crates/ra_ide_db/src/defs.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 30ca9d8b0..c0f7c1c9f 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -292,7 +292,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { match parent.kind() { STRUCT_DEF => HighlightTag::Struct.into(), ENUM_DEF => HighlightTag::Enum.into(), - UNION_KW => HighlightTag::Union.into(), + UNION_DEF => HighlightTag::Union.into(), TRAIT_DEF => HighlightTag::Trait.into(), TYPE_ALIAS_DEF => HighlightTag::TypeAlias.into(), TYPE_PARAM => HighlightTag::TypeParam.into(), diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index e10e72f71..484755158 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -90,6 +90,10 @@ pub fn classify_name(sema: &Semantics, name: &ast::Name) -> Option let def: hir::Struct = sema.to_def(&it)?; Some(from_module_def(def.into())) }, + ast::UnionDef(it) => { + let def: hir::Union = sema.to_def(&it)?; + Some(from_module_def(def.into())) + }, ast::EnumDef(it) => { let def: hir::Enum = sema.to_def(&it)?; Some(from_module_def(def.into())) -- cgit v1.2.3