Fix function call highlighting

This commit is contained in:
Laurenz 2023-02-03 17:46:53 +01:00
parent fd7b629f67
commit 9e918d06ad
5 changed files with 9 additions and 30 deletions

View File

@ -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);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 85 KiB

View File

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -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[] $
```