mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-12-04 09:02:49 +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
|
/(\.\s*)?/.source + IDENTIFIER.source + /\s*(?=\(|\[)/.source
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
end: /(?:(?<=\)|\])(?:(?![\[\(\.])|$))|(?=[\n;\}\]\)]|$)/,
|
end: strict
|
||||||
|
? /(?:(?<=\)|\])(?:(?![\[\(\.])|$))|(?=[\s;\,\}\]\)]|$)/
|
||||||
|
: /(?:(?<=\)|\])(?:(?![\[\(\.])|$))|(?=[\n;\,\}\]\)]|$)/,
|
||||||
patterns: [
|
patterns: [
|
||||||
// todo: comments?
|
// todo: comments?
|
||||||
// {
|
// {
|
||||||
|
|
@ -1627,6 +1629,7 @@ export const typst: textmate.Grammar = {
|
||||||
...setStatement().repository,
|
...setStatement().repository,
|
||||||
...showStatement().repository,
|
...showStatement().repository,
|
||||||
strictFuncCallOrPropAccess: funcCallOrPropAccess(true),
|
strictFuncCallOrPropAccess: funcCallOrPropAccess(true),
|
||||||
|
// todo: distinguish strict and non-strict for markup and code mode.
|
||||||
// funcCallOrPropAccess: funcCallOrPropAccess(false),
|
// funcCallOrPropAccess: funcCallOrPropAccess(false),
|
||||||
callArgs,
|
callArgs,
|
||||||
funcRestParam,
|
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