fix: stop atom expressions before backslash (#1835)

* fix: stop atom expressions before marks

* dev: fix it
This commit is contained in:
Myriad-Dreamin 2025-06-23 11:32:55 +08:00 committed by GitHub
parent 96510385a1
commit 4bfb5c22da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 1 deletions

View file

@ -691,7 +691,7 @@ const enterExpression = (kind: string, seek: RegExp): textmate.Pattern => {
),
),
// The hash starts a string or an identifier.
/(?<!#)(?=["\_\{])/,
/(?<!#)(?=["\\\_\{])/,
/(?<![#\]\}\]])(?=\[)/,
// This means that we are on a dot and the next character is not a valid identifier start, but we are not at the beginning of hash or number
/(?=\.(?:[^0-9\p{XID_Start}_]|$))/u,

View file

@ -0,0 +1,2 @@
#let quote(x) = $\"#x\"$
Rest of code here...

View file

@ -0,0 +1,20 @@
>#let quote(x) = $\"#x\"$
#^ 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 entity.name.function.typst
# ^ source.typst meta.expr.let.typst meta.brace.round.typst
# ^ source.typst meta.expr.let.typst variable.other.readwrite.typst
# ^ source.typst meta.expr.let.typst meta.brace.round.typst
# ^ source.typst meta.expr.let.typst
# ^^ source.typst meta.expr.let.typst keyword.operator.assignment.typst
# ^ source.typst meta.expr.let.typst markup.math.typst punctuation.definition.string.begin.math.typst
# ^^ source.typst meta.expr.let.typst markup.math.typst constant.character.escape.content.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 constant.character.escape.content.typst
# ^ source.typst meta.expr.let.typst markup.math.typst punctuation.definition.string.end.math.typst
>Rest of code here...
#^^^^^^^^^^^^^^^^^ source.typst
# ^^^ source.typst punctuation.definition.ellipsis.typst
>