mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Fix highlighting of identifiers before brackets
This commit is contained in:
parent
2606034ac7
commit
9984e73ff3
@ -261,10 +261,13 @@ fn highlight_ident(node: &LinkedNode) -> Option<Tag> {
|
|||||||
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()
|
||||||
&& next.kind() == SyntaxKind::LeftParen
|
&& ((next.kind() == SyntaxKind::LeftParen
|
||||||
&& matches!(next.parent_kind(), Some(SyntaxKind::Args | SyntaxKind::Params))
|
&& matches!(
|
||||||
|| (next.kind() == SyntaxKind::LeftBracket
|
next.parent_kind(),
|
||||||
&& next.parent_kind() == Some(SyntaxKind::ContentBlock))
|
Some(SyntaxKind::Args | SyntaxKind::Params)
|
||||||
|
))
|
||||||
|
|| (next.kind() == SyntaxKind::LeftBracket
|
||||||
|
&& next.parent_kind() == Some(SyntaxKind::ContentBlock)))
|
||||||
{
|
{
|
||||||
return Some(Tag::Function);
|
return Some(Tag::Function);
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 80 KiB |
@ -38,4 +38,5 @@ $ #hello() $
|
|||||||
$ #hello.world $
|
$ #hello.world $
|
||||||
$ #hello.world() $
|
$ #hello.world() $
|
||||||
$ #box[] $
|
$ #box[] $
|
||||||
|
#if foo []
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user