From 04fb8b288aa7c80607da79db7d085a4820b95a9d Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sat, 23 Apr 2022 21:55:58 +0200 Subject: Show rules with type ascribed object --- src/syntax/highlight.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/syntax/highlight.rs') 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), -- cgit v1.2.3