dev: terminate expression before math blocks (#347)

* docs: minor updates

* dev: terminate expression before math blocks
This commit is contained in:
Myriad-Dreamin 2024-06-26 18:14:04 +08:00 committed by GitHub
parent 7faf7973ef
commit 00ec24e18f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 1 deletions

View file

@ -302,7 +302,7 @@ const enterExpression = (kind: string, seek: RegExp): textmate.Pattern => {
return {
/// name: 'markup.expr.typst'
begin: new RegExp("#" + seek.source),
end: /(?<=;)|(?<=[\)\]\}])(?![;\(\[])|(?=[\s\]\}\)]|$)|(;)/,
end: /(?<=;)|(?<=[\)\]\}])(?![;\(\[\$])|(?=[\s\}\]\)\$]|$)|(;)/,
beginCaptures: {
"0": {
name: kind,

View file

@ -0,0 +1,2 @@
#let xxx = n => $#n$
#xxx(1)

View file

@ -0,0 +1,21 @@
>#let xxx = n => $#n$
#^ source.typst keyword.control.hash.typst
# ^^^ source.typst meta.expr.let.typst storage.type.typst
# ^ source.typst meta.expr.let.typst
# ^^^ source.typst meta.expr.let.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.let.typst
# ^^ source.typst meta.expr.let.typst keyword.operator.assignment.typst
# ^ source.typst meta.expr.let.typst variable.parameter.typst
# ^ source.typst meta.expr.let.typst
# ^^ source.typst meta.expr.let.typst storage.type.function.arrow.typst
# ^ source.typst meta.expr.let.typst
# ^ source.typst meta.expr.let.typst markup.math.typst punctuation.definition.string.math.typst
# ^ source.typst meta.expr.let.typst markup.math.typst variable.other.readwrite.hash.typst
# ^ source.typst meta.expr.let.typst markup.math.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.let.typst markup.math.typst punctuation.definition.string.math.typst
>#xxx(1)
#^ source.typst entity.name.function.hash.typst
# ^^^ source.typst meta.expr.call.typst entity.name.function.typst
# ^ source.typst meta.expr.call.typst meta.brace.round.typst
# ^ source.typst meta.expr.call.typst constant.numeric.integer.typst
# ^ source.typst meta.expr.call.typst meta.brace.round.typst