mirror of
https://github.com/typst/typst
synced 2025-05-13 12:36:23 +08:00
Fix function call highlighting
This commit is contained in:
parent
fd7b629f67
commit
9e918d06ad
@ -259,8 +259,10 @@ fn highlight_ident(node: &LinkedNode) -> Option<Category> {
|
|||||||
let next_leaf = node.next_leaf();
|
let next_leaf = node.next_leaf();
|
||||||
if let Some(next) = &next_leaf {
|
if let Some(next) = &next_leaf {
|
||||||
if node.range().end == next.offset()
|
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))
|
&& matches!(next.parent_kind(), Some(SyntaxKind::Args | SyntaxKind::Params))
|
||||||
|
|| (next.kind() == SyntaxKind::LeftBracket
|
||||||
|
&& next.parent_kind() == Some(SyntaxKind::ContentBlock))
|
||||||
{
|
{
|
||||||
return Some(Category::Function);
|
return Some(Category::Function);
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 85 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
@ -10,9 +10,9 @@
|
|||||||
#show module.func: func
|
#show module.func: func
|
||||||
#show module.func: it => {}
|
#show module.func: it => {}
|
||||||
#foo(ident: ident)
|
#foo(ident: ident)
|
||||||
|
|
||||||
#hello
|
#hello
|
||||||
#hello()
|
#hello()
|
||||||
|
#box[]
|
||||||
#hello.world
|
#hello.world
|
||||||
#hello.world()
|
#hello.world()
|
||||||
#hello().world()
|
#hello().world()
|
||||||
@ -20,45 +20,22 @@
|
|||||||
#hello.my.world()
|
#hello.my.world()
|
||||||
#hello.my().world
|
#hello.my().world
|
||||||
#hello.my().world()
|
#hello.my().world()
|
||||||
|
#{ hello }
|
||||||
|
#{ hello() }
|
||||||
|
#{ hello.world() }
|
||||||
$ hello $
|
$ hello $
|
||||||
$ hello() $
|
$ hello() $
|
||||||
|
$ box[] $
|
||||||
$ hello.world $
|
$ hello.world $
|
||||||
$ hello.world() $
|
$ hello.world() $
|
||||||
$ hello().world() $
|
|
||||||
$ hello.my.world $
|
|
||||||
$ hello.my.world() $
|
$ hello.my.world() $
|
||||||
$ hello.my().world $
|
|
||||||
$ hello.my().world() $
|
|
||||||
$ f_zeta(x), f_zeta(x)/1 $
|
$ 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) $
|
$ emph(hello.my().world) $
|
||||||
$ emph(hello.my().world()) $
|
$ emph(hello.my().world()) $
|
||||||
|
|
||||||
$ #hello $
|
$ #hello $
|
||||||
$ #hello() $
|
$ #hello() $
|
||||||
$ #hello.world $
|
$ #hello.world $
|
||||||
$ #hello.world() $
|
$ #hello.world() $
|
||||||
$ #hello().world() $
|
$ #box[] $
|
||||||
$ #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() }
|
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user