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 { 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 Binary files a/tests/ref/compiler/highlight.png and b/tests/ref/compiler/highlight.png differ diff --git a/tests/ref/text/raw-highlight.png b/tests/ref/text/raw-code.png similarity index 100% rename from tests/ref/text/raw-highlight.png rename to tests/ref/text/raw-code.png 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 similarity index 100% rename from tests/typ/text/raw-highlight.typ rename to tests/typ/text/raw-code.typ