mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
Fix union classification
This commit is contained in:
parent
2995fd2c87
commit
da40149572
3 changed files with 5 additions and 3 deletions
|
@ -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(),
|
||||
|
|
|
@ -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()))
|
||||
|
|
|
@ -460,14 +460,12 @@
|
|||
{
|
||||
"selector": "typeAlias",
|
||||
"scope": [
|
||||
"entity.name.type",
|
||||
"entity.name.typeAlias"
|
||||
]
|
||||
},
|
||||
{
|
||||
"selector": "union",
|
||||
"scope": [
|
||||
"entity.name.type",
|
||||
"entity.name.union"
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue