aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-28 14:03:09 +0000
committerAleksey Kladov <[email protected]>2020-02-28 14:03:09 +0000
commitda401495722ca43b60834399208e822dbbadd06d (patch)
treeb3edc1e63af556f2ff0906a8219262814e10c90f
parent2995fd2c87bba98d4cb7957a182a58bee68d86ba (diff)
Fix union classification
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs2
-rw-r--r--crates/ra_ide_db/src/defs.rs4
-rw-r--r--editors/code/package.json2
3 files changed, 5 insertions, 3 deletions
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 {
292 match parent.kind() { 292 match parent.kind() {
293 STRUCT_DEF => HighlightTag::Struct.into(), 293 STRUCT_DEF => HighlightTag::Struct.into(),
294 ENUM_DEF => HighlightTag::Enum.into(), 294 ENUM_DEF => HighlightTag::Enum.into(),
295 UNION_KW => HighlightTag::Union.into(), 295 UNION_DEF => HighlightTag::Union.into(),
296 TRAIT_DEF => HighlightTag::Trait.into(), 296 TRAIT_DEF => HighlightTag::Trait.into(),
297 TYPE_ALIAS_DEF => HighlightTag::TypeAlias.into(), 297 TYPE_ALIAS_DEF => HighlightTag::TypeAlias.into(),
298 TYPE_PARAM => HighlightTag::TypeParam.into(), 298 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<RootDatabase>, name: &ast::Name) -> Option
90 let def: hir::Struct = sema.to_def(&it)?; 90 let def: hir::Struct = sema.to_def(&it)?;
91 Some(from_module_def(def.into())) 91 Some(from_module_def(def.into()))
92 }, 92 },
93 ast::UnionDef(it) => {
94 let def: hir::Union = sema.to_def(&it)?;
95 Some(from_module_def(def.into()))
96 },
93 ast::EnumDef(it) => { 97 ast::EnumDef(it) => {
94 let def: hir::Enum = sema.to_def(&it)?; 98 let def: hir::Enum = sema.to_def(&it)?;
95 Some(from_module_def(def.into())) 99 Some(from_module_def(def.into()))
diff --git a/editors/code/package.json b/editors/code/package.json
index b013c3f4a..862de3210 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -460,14 +460,12 @@
460 { 460 {
461 "selector": "typeAlias", 461 "selector": "typeAlias",
462 "scope": [ 462 "scope": [
463 "entity.name.type",
464 "entity.name.typeAlias" 463 "entity.name.typeAlias"
465 ] 464 ]
466 }, 465 },
467 { 466 {
468 "selector": "union", 467 "selector": "union",
469 "scope": [ 468 "scope": [
470 "entity.name.type",
471 "entity.name.union" 469 "entity.name.union"
472 ] 470 ]
473 }, 471 },