summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ide/highlight.rs11
-rw-r--r--tests/ref/compiler/highlight.pngbin80489 -> 81677 bytes
-rw-r--r--tests/typ/compiler/highlight.typ1
3 files changed, 8 insertions, 4 deletions
diff --git a/src/ide/highlight.rs b/src/ide/highlight.rs
index cf8fdd10..9180aaee 100644
--- a/src/ide/highlight.rs
+++ b/src/ide/highlight.rs
@@ -261,10 +261,13 @@ fn highlight_ident(node: &LinkedNode) -> Option<Tag> {
let next_leaf = node.next_leaf();
if let Some(next) = &next_leaf {
if node.range().end == next.offset()
- && next.kind() == SyntaxKind::LeftParen
- && matches!(next.parent_kind(), Some(SyntaxKind::Args | SyntaxKind::Params))
- || (next.kind() == SyntaxKind::LeftBracket
- && next.parent_kind() == Some(SyntaxKind::ContentBlock))
+ && ((next.kind() == SyntaxKind::LeftParen
+ && matches!(
+ next.parent_kind(),
+ Some(SyntaxKind::Args | SyntaxKind::Params)
+ ))
+ || (next.kind() == SyntaxKind::LeftBracket
+ && next.parent_kind() == Some(SyntaxKind::ContentBlock)))
{
return Some(Tag::Function);
}
diff --git a/tests/ref/compiler/highlight.png b/tests/ref/compiler/highlight.png
index 182aca45..7f69fd6b 100644
--- a/tests/ref/compiler/highlight.png
+++ b/tests/ref/compiler/highlight.png
Binary files differ
diff --git a/tests/typ/compiler/highlight.typ b/tests/typ/compiler/highlight.typ
index db2420a7..1cbeaf9d 100644
--- a/tests/typ/compiler/highlight.typ
+++ b/tests/typ/compiler/highlight.typ
@@ -38,4 +38,5 @@ $ #hello() $
$ #hello.world $
$ #hello.world() $
$ #box[] $
+#if foo []
```