mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +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() {
|
match parent.kind() {
|
||||||
STRUCT_DEF => HighlightTag::Struct.into(),
|
STRUCT_DEF => HighlightTag::Struct.into(),
|
||||||
ENUM_DEF => HighlightTag::Enum.into(),
|
ENUM_DEF => HighlightTag::Enum.into(),
|
||||||
UNION_KW => HighlightTag::Union.into(),
|
UNION_DEF => HighlightTag::Union.into(),
|
||||||
TRAIT_DEF => HighlightTag::Trait.into(),
|
TRAIT_DEF => HighlightTag::Trait.into(),
|
||||||
TYPE_ALIAS_DEF => HighlightTag::TypeAlias.into(),
|
TYPE_ALIAS_DEF => HighlightTag::TypeAlias.into(),
|
||||||
TYPE_PARAM => HighlightTag::TypeParam.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)?;
|
let def: hir::Struct = sema.to_def(&it)?;
|
||||||
Some(from_module_def(def.into()))
|
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) => {
|
ast::EnumDef(it) => {
|
||||||
let def: hir::Enum = sema.to_def(&it)?;
|
let def: hir::Enum = sema.to_def(&it)?;
|
||||||
Some(from_module_def(def.into()))
|
Some(from_module_def(def.into()))
|
||||||
|
|
|
@ -460,14 +460,12 @@
|
||||||
{
|
{
|
||||||
"selector": "typeAlias",
|
"selector": "typeAlias",
|
||||||
"scope": [
|
"scope": [
|
||||||
"entity.name.type",
|
|
||||||
"entity.name.typeAlias"
|
"entity.name.typeAlias"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"selector": "union",
|
"selector": "union",
|
||||||
"scope": [
|
"scope": [
|
||||||
"entity.name.type",
|
|
||||||
"entity.name.union"
|
"entity.name.union"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue