summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-02-03 17:46:53 +0100
committerLaurenz <laurmaedje@gmail.com>2023-02-03 17:46:53 +0100
commit9e918d06adfdd680f153784e85657e45e9675ec6 (patch)
tree3f411c1cc7b2ed7855ca1433e6ad1f0a7ab1701c
parentfd7b629f674e8ac66394c6cb8f945446003e4486 (diff)
Fix function call highlighting
-rw-r--r--src/ide/highlight.rs4
-rw-r--r--tests/ref/compiler/highlight.pngbin142118 -> 87216 bytes
-rw-r--r--tests/ref/text/raw-code.png (renamed from tests/ref/text/raw-highlight.png)bin40777 -> 40777 bytes
-rw-r--r--tests/typ/compiler/highlight.typ35
-rw-r--r--tests/typ/text/raw-code.typ (renamed from tests/typ/text/raw-highlight.typ)0
5 files changed, 9 insertions, 30 deletions
diff --git a/src/ide/highlight.rs b/src/ide/highlight.rs
index 0ce6bf8a..20aa6998 100644
--- a/src/ide/highlight.rs
+++ b/src/ide/highlight.rs
@@ -259,8 +259,10 @@ fn highlight_ident(node: &LinkedNode) -> Option<Category> {
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)
+ && 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(Category::Function);
}
diff --git a/tests/ref/compiler/highlight.png b/tests/ref/compiler/highlight.png
index dba5591e..236a09cb 100644
--- a/tests/ref/compiler/highlight.png
+++ b/tests/ref/compiler/highlight.png
Binary files differ
diff --git a/tests/ref/text/raw-highlight.png b/tests/ref/text/raw-code.png
index e0387870..e0387870 100644
--- a/tests/ref/text/raw-highlight.png
+++ b/tests/ref/text/raw-code.png
Binary files differ
diff --git a/tests/typ/compiler/highlight.typ b/tests/typ/compiler/highlight.typ
index 2dc2474a..db2420a7 100644
--- a/tests/typ/compiler/highlight.typ
+++ b/tests/typ/compiler/highlight.typ
@@ -10,9 +10,9 @@
#show module.func: func
#show module.func: it => {}
#foo(ident: ident)
-
#hello
#hello()
+#box[]
#hello.world
#hello.world()
#hello().world()
@@ -20,45 +20,22 @@
#hello.my.world()
#hello.my().world
#hello.my().world()
-
+#{ hello }
+#{ hello() }
+#{ hello.world() }
$ hello $
$ hello() $
+$ box[] $
$ hello.world $
$ hello.world() $
-$ hello().world() $
-$ hello.my.world $
$ hello.my.world() $
-$ hello.my().world $
-$ hello.my().world() $
$ f_zeta(x), f_zeta(x)/1 $
-
-$ emph(hello) $
-$ emph(hello()) $
-$ emph(hello.world) $
-$ emph(hello.world()) $
-$ emph(hello().world()) $
-$ emph(hello.my.world) $
$ emph(hello.my.world()) $
$ emph(hello.my().world) $
$ emph(hello.my().world()) $
-
$ #hello $
$ #hello() $
$ #hello.world $
$ #hello.world() $
-$ #hello().world() $
-$ #hello.my.world $
-$ #hello.my.world() $
-$ #hello.my().world $
-$ #hello.my().world() $
-
-#{ hello }
-#{ hello() }
-#{ hello.world }
-#{ hello.world() }
-#{ hello().world() }
-#{ hello.my.world }
-#{ hello.my.world() }
-#{ hello.my().world }
-#{ hello.my().world() }
+$ #box[] $
```
diff --git a/tests/typ/text/raw-highlight.typ b/tests/typ/text/raw-code.typ
index d89f1c05..d89f1c05 100644
--- a/tests/typ/text/raw-highlight.typ
+++ b/tests/typ/text/raw-code.typ