Skip to content

Commit

Permalink
fix: parse quotes near the atomic hash expression (#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin authored Aug 26, 2024
1 parent cfa04bd commit ccaf83e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion syntaxes/textmate/main.mts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ const enterExpression = (kind: string, seek: RegExp): textmate.Pattern => {
/// name: 'markup.expr.typst'
begin: new RegExp("#" + seek.source),
// `?=(?<![\d#])\.[^\p{XID_Start}_]`: 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
end: /(?<=;)|(?<=[\)\]\}])(?![;\(\[\$])|(?=\.(?:[^0-9\p{XID_Start}_]|$))|(?=[\s\}\]\)\$]|$)|(;)/u
end: /(?<=;)|(?<=[\)\]\}])(?![;\(\[\$])|(?<!#)(?=")|(?=\.(?:[^0-9\p{XID_Start}_]|$))|(?=[\s\}\]\)\$]|$)|(;)/u
.source,
beginCaptures: {
"0": {
Expand Down
3 changes: 1 addition & 2 deletions syntaxes/textmate/tests/unit/bugs/tinymist-issue492.typ.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@
# ^^ source.typst variable.other.readwrite.typst
# ^ source.typst keyword.operator.accessor.typst
# ^ source.typst variable.other.readwrite.typst
# ^ source.typst string.quoted.double.typst punctuation.definition.string.typst
# ^^^^^^^^^^^^^ source.typst string.quoted.double.typst
# ^^^^^^^^^^^^^^ source.typst
>
2 changes: 2 additions & 0 deletions syntaxes/textmate/tests/unit/bugs/tinymist-issue556.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#ident"foo
"bar
6 changes: 6 additions & 0 deletions syntaxes/textmate/tests/unit/bugs/tinymist-issue556.typ.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
>#ident"foo
#^ source.typst variable.other.readwrite.hash.typst
# ^^^^^ source.typst variable.other.readwrite.typst
# ^^^^^ source.typst
>"bar
#^^^^^ source.typst

0 comments on commit ccaf83e

Please sign in to comment.