diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-01-30 18:29:09 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-01-30 18:29:09 +0100 |
| commit | 3a4c5ae4b96ff5c2cd17a2f41a67398f21da0373 (patch) | |
| tree | 8ac95426ccfe6bb0843a146878864919a8f55c04 /src/ide | |
| parent | 1d86f418315a2dd632016c32bfedfcf2af1b0369 (diff) | |
Highlighting and docs fixes
Diffstat (limited to 'src/ide')
| -rw-r--r-- | src/ide/highlight.rs | 12 |
1 files changed, 8 insertions, 4 deletions
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<Category> { /// Highlight an identifier based on context. fn highlight_ident(node: &LinkedNode) -> Option<Category> { // 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<Category> { } // 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); |
