Fix union classification

This commit is contained in:
Aleksey Kladov 2020-02-28 15:03:09 +01:00
parent 2995fd2c87
commit da40149572
3 changed files with 5 additions and 3 deletions

View file

@ -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(),

View file

@ -90,6 +90,10 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, 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()))

View file

@ -460,14 +460,12 @@
{
"selector": "typeAlias",
"scope": [
"entity.name.type",
"entity.name.typeAlias"
]
},
{
"selector": "union",
"scope": [
"entity.name.type",
"entity.name.union"
]
},