mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-12-04 00:54:43 +00:00
fix: properly stops call expressions (#273)
This commit is contained in:
parent
fff227f3ae
commit
6a438e79c4
3 changed files with 43 additions and 1 deletions
|
|
@ -1473,7 +1473,9 @@ const funcCallOrPropAccess = (strict: boolean): textmate.Pattern => {
|
|||
/(\.\s*)?/.source + IDENTIFIER.source + /\s*(?=\(|\[)/.source
|
||||
)
|
||||
),
|
||||
end: /(?:(?<=\)|\])(?:(?![\[\(\.])|$))|(?=[\n;\}\]\)]|$)/,
|
||||
end: strict
|
||||
? /(?:(?<=\)|\])(?:(?![\[\(\.])|$))|(?=[\s;\,\}\]\)]|$)/
|
||||
: /(?:(?<=\)|\])(?:(?![\[\(\.])|$))|(?=[\n;\,\}\]\)]|$)/,
|
||||
patterns: [
|
||||
// todo: comments?
|
||||
// {
|
||||
|
|
@ -1627,6 +1629,7 @@ export const typst: textmate.Grammar = {
|
|||
...setStatement().repository,
|
||||
...showStatement().repository,
|
||||
strictFuncCallOrPropAccess: funcCallOrPropAccess(true),
|
||||
// todo: distinguish strict and non-strict for markup and code mode.
|
||||
// funcCallOrPropAccess: funcCallOrPropAccess(false),
|
||||
callArgs,
|
||||
funcRestParam,
|
||||
|
|
|
|||
5
syntaxes/textmate/tests/unit/bugs/expression-field.typ
Normal file
5
syntaxes/textmate/tests/unit/bugs/expression-field.typ
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#link("https://microsoft.github.io/language-server-protocol/")[Language Server Protocol]. tinymist
|
||||
|
||||
#{
|
||||
text(red)[] . fields()
|
||||
}
|
||||
34
syntaxes/textmate/tests/unit/bugs/expression-field.typ.snap
Normal file
34
syntaxes/textmate/tests/unit/bugs/expression-field.typ.snap
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
>#link("https://microsoft.github.io/language-server-protocol/")[Language Server Protocol]. tinymist
|
||||
#^ 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 string.quoted.double.typst punctuation.definition.string.typst
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.typst meta.expr.call.typst string.quoted.double.typst
|
||||
# ^ source.typst meta.expr.call.typst string.quoted.double.typst punctuation.definition.string.typst
|
||||
# ^ source.typst meta.expr.call.typst meta.brace.round.typst
|
||||
# ^ source.typst meta.expr.call.typst meta.brace.square.typst
|
||||
# ^^^^^^^^^^^^^^^^^^^^^^^^ source.typst meta.expr.call.typst
|
||||
# ^ source.typst meta.expr.call.typst meta.brace.square.typst
|
||||
# ^ source.typst meta.expr.call.typst keyword.operator.accessor.typst
|
||||
# ^^^^^^^^^^ source.typst
|
||||
>
|
||||
>#{
|
||||
#^ source.typst keyword.control.hash.typst
|
||||
# ^ source.typst meta.brace.curly.typst
|
||||
> text(red)[] . fields()
|
||||
#^^ source.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 support.type.builtin.typst
|
||||
# ^ source.typst meta.expr.call.typst meta.brace.round.typst
|
||||
# ^ source.typst meta.expr.call.typst meta.brace.square.typst
|
||||
# ^ source.typst meta.expr.call.typst meta.brace.square.typst
|
||||
# ^^ source.typst
|
||||
# ^ source.typst keyword.operator.accessor.typst
|
||||
# ^^ source.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 meta.brace.round.typst
|
||||
>}
|
||||
#^ source.typst meta.brace.curly.typst
|
||||
>
|
||||
Loading…
Add table
Add a link
Reference in a new issue