diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-04-23 21:55:58 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-04-23 21:55:58 +0200 |
| commit | 04fb8b288aa7c80607da79db7d085a4820b95a9d (patch) | |
| tree | 7ca96d09d511274ebac298c329d5eef53a290d9c /src/syntax/highlight.rs | |
| parent | 7a2cc3e7d29d16c5cf9b5a93a688e14da93c8662 (diff) | |
Show rules with type ascribed object
Diffstat (limited to 'src/syntax/highlight.rs')
| -rw-r--r-- | src/syntax/highlight.rs | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/syntax/highlight.rs b/src/syntax/highlight.rs index 10dfce69..9bee73ae 100644 --- a/src/syntax/highlight.rs +++ b/src/syntax/highlight.rs @@ -178,13 +178,21 @@ impl Category { NodeKind::None => Some(Category::None), NodeKind::Auto => Some(Category::Auto), NodeKind::Ident(_) => match parent.kind() { - NodeKind::Named => None, - NodeKind::ClosureExpr if i == 0 => Some(Category::Function), - NodeKind::SetExpr => Some(Category::Function), - NodeKind::ShowExpr => Some(Category::Function), + NodeKind::Markup(_) => Some(Category::Variable), NodeKind::FuncCall => Some(Category::Function), NodeKind::MethodCall if i > 0 => Some(Category::Function), - NodeKind::Markup(_) => Some(Category::Variable), + NodeKind::ClosureExpr if i == 0 => Some(Category::Function), + NodeKind::SetExpr => Some(Category::Function), + NodeKind::ShowExpr + if parent + .children() + .filter(|c| matches!(c.kind(), NodeKind::Ident(_))) + .map(RedRef::span) + .nth(1) + .map_or(false, |span| span == child.span()) => + { + Some(Category::Function) + } _ => None, }, NodeKind::Bool(_) => Some(Category::Bool), |
