From 3a4c5ae4b96ff5c2cd17a2f41a67398f21da0373 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 30 Jan 2023 18:29:09 +0100 Subject: Highlighting and docs fixes --- src/ide/highlight.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/ide') diff --git a/src/ide/highlight.rs b/src/ide/highlight.rs index 2e418e22..e00007f3 100644 --- a/src/ide/highlight.rs +++ b/src/ide/highlight.rs @@ -256,9 +256,13 @@ pub fn highlight(node: &LinkedNode) -> Option { /// Highlight an identifier based on context. fn highlight_ident(node: &LinkedNode) -> Option { // Are we directly before an argument list? - let next_leaf_kind = node.next_leaf().map(|leaf| leaf.kind()); - if matches!(next_leaf_kind, Some(SyntaxKind::LeftParen | SyntaxKind::LeftBracket)) { - return Some(Category::Function); + let next_leaf = node.next_leaf(); + if let Some(next) = &next_leaf { + if node.range().end == next.offset() + && matches!(next.kind(), SyntaxKind::LeftParen | SyntaxKind::LeftBracket) + { + return Some(Category::Function); + } } // Are we in math? @@ -273,7 +277,7 @@ fn highlight_ident(node: &LinkedNode) -> Option { } // Are we directly before a show rule colon? - if next_leaf_kind == Some(SyntaxKind::Colon) + if next_leaf.map(|leaf| leaf.kind()) == Some(SyntaxKind::Colon) && ancestor.parent_kind() == Some(SyntaxKind::ShowRule) { return Some(Category::Function); -- cgit v1.2.3