diff options
author | Matthew Jasper <[email protected]> | 2020-05-21 17:44:45 +0100 |
---|---|---|
committer | Matthew Jasper <[email protected]> | 2020-05-24 15:12:17 +0100 |
commit | 1895888aec1c87096809057b19a602e1cec9ada6 (patch) | |
tree | 0bee9dbb6794748dc3aebce59292cbf466010af2 /crates/ra_ide/src | |
parent | e2d36cb692f042f2051a8a88d271a297a3d333a4 (diff) |
Handle more cases in `highlight_name_by_syntax`
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 5f20fae80..61aeb28cb 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -481,23 +481,31 @@ fn highlight_name(db: &RootDatabase, def: Definition) -> Highlight { | |||
481 | } | 481 | } |
482 | 482 | ||
483 | fn highlight_name_by_syntax(name: ast::Name) -> Highlight { | 483 | fn highlight_name_by_syntax(name: ast::Name) -> Highlight { |
484 | let default = HighlightTag::Function.into(); | 484 | let default = HighlightTag::UnresolvedReference; |
485 | 485 | ||
486 | let parent = match name.syntax().parent() { | 486 | let parent = match name.syntax().parent() { |
487 | Some(it) => it, | 487 | Some(it) => it, |
488 | _ => return default, | 488 | _ => return default.into(), |
489 | }; | 489 | }; |
490 | 490 | ||
491 | match parent.kind() { | 491 | let tag = match parent.kind() { |
492 | STRUCT_DEF => HighlightTag::Struct.into(), | 492 | STRUCT_DEF => HighlightTag::Struct, |
493 | ENUM_DEF => HighlightTag::Enum.into(), | 493 | ENUM_DEF => HighlightTag::Enum, |
494 | UNION_DEF => HighlightTag::Union.into(), | 494 | UNION_DEF => HighlightTag::Union, |
495 | TRAIT_DEF => HighlightTag::Trait.into(), | 495 | TRAIT_DEF => HighlightTag::Trait, |
496 | TYPE_ALIAS_DEF => HighlightTag::TypeAlias.into(), | 496 | TYPE_ALIAS_DEF => HighlightTag::TypeAlias, |
497 | TYPE_PARAM => HighlightTag::TypeParam.into(), | 497 | TYPE_PARAM => HighlightTag::TypeParam, |
498 | RECORD_FIELD_DEF => HighlightTag::Field.into(), | 498 | RECORD_FIELD_DEF => HighlightTag::Field, |
499 | MODULE => HighlightTag::Module, | ||
500 | FN_DEF => HighlightTag::Function, | ||
501 | CONST_DEF => HighlightTag::Constant, | ||
502 | STATIC_DEF => HighlightTag::Static, | ||
503 | ENUM_VARIANT => HighlightTag::EnumVariant, | ||
504 | BIND_PAT => HighlightTag::Local, | ||
499 | _ => default, | 505 | _ => default, |
500 | } | 506 | }; |
507 | |||
508 | tag.into() | ||
501 | } | 509 | } |
502 | 510 | ||
503 | fn highlight_injection( | 511 | fn highlight_injection( |