mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 18:28:02 +00:00
fix: exclude content block syntax when parsing math arguments (#1124)
This commit is contained in:
parent
bc2e07bb0c
commit
a6a6d88143
6 changed files with 44 additions and 7 deletions
3
syntaxes/textmate/.gitignore
vendored
3
syntaxes/textmate/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
*.tmLanguage.json
|
||||
dist
|
||||
tests/official-testing
|
||||
tests/official-testing
|
||||
tests/packages
|
|
@ -1456,7 +1456,7 @@ const mathCallArgs: textmate.Pattern = {
|
|||
],
|
||||
};
|
||||
|
||||
const mathCallStart = new RegExp(MATH_IDENTIFIER.source + /(?=\(|\[)/.source);
|
||||
const mathCallStart = new RegExp(MATH_IDENTIFIER.source + /(?=\()/.source);
|
||||
|
||||
const mathFuncCallOrPropAccess = (): textmate.Pattern => {
|
||||
return {
|
||||
|
@ -1464,11 +1464,11 @@ const mathFuncCallOrPropAccess = (): textmate.Pattern => {
|
|||
begin: lookAhead(
|
||||
new RegExp(
|
||||
`(?:${oneOf(MATH_DOT_ACCESS, MATH_IDENTIFIER).source})` +
|
||||
/(?=\(|\[)/.source
|
||||
/(?=\()/.source
|
||||
)
|
||||
),
|
||||
end: replaceGroup(
|
||||
/(?:(?<=[\)\]])(?![\[\(\.]|[CallStart]))|(?=[\$\s;,\}\]\)]|$)/u,
|
||||
/(?:(?<=[\)])(?![\(\.]|[CallStart]))|(?=[\$\s;,\}\]\)]|$)/u,
|
||||
"[CallStart]",
|
||||
mathCallStart
|
||||
),
|
||||
|
@ -1505,9 +1505,6 @@ const mathFuncCallOrPropAccess = (): textmate.Pattern => {
|
|||
{
|
||||
include: "#mathCallArgs",
|
||||
},
|
||||
{
|
||||
include: "#contentBlock",
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
|
5
syntaxes/textmate/tests/unit/basic/arg_bracket.typ
Normal file
5
syntaxes/textmate/tests/unit/basic/arg_bracket.typ
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
#text(
|
||||
[string is [gissssssss...
|
||||
],
|
||||
)
|
19
syntaxes/textmate/tests/unit/basic/arg_bracket.typ.snap
Normal file
19
syntaxes/textmate/tests/unit/basic/arg_bracket.typ.snap
Normal file
|
@ -0,0 +1,19 @@
|
|||
>
|
||||
>#text(
|
||||
#^ 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
|
||||
> [string is [gissssssss...
|
||||
#^^ source.typst meta.expr.call.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
|
||||
# ^^^ source.typst meta.expr.call.typst punctuation.definition.ellipsis.typst
|
||||
> ],
|
||||
#^^ source.typst meta.expr.call.typst
|
||||
# ^ source.typst meta.expr.call.typst meta.brace.square.typst
|
||||
# ^^ source.typst meta.expr.call.typst
|
||||
>)
|
||||
#^ source.typst meta.expr.call.typst markup.content.brace.typst
|
||||
>
|
1
syntaxes/textmate/tests/unit/math/arg_bracket.typ
Normal file
1
syntaxes/textmate/tests/unit/math/arg_bracket.typ
Normal file
|
@ -0,0 +1 @@
|
|||
Where it takes a minimum on $[0;+oo[$ for $x = alpha$
|
14
syntaxes/textmate/tests/unit/math/arg_bracket.typ.snap
Normal file
14
syntaxes/textmate/tests/unit/math/arg_bracket.typ.snap
Normal file
|
@ -0,0 +1,14 @@
|
|||
>Where it takes a minimum on $[0;+oo[$ for $x = alpha$
|
||||
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.typst
|
||||
# ^ source.typst markup.math.typst punctuation.definition.string.begin.math.typst
|
||||
# ^ source.typst markup.math.typst markup.content.brace.typst
|
||||
# ^^^ source.typst markup.math.typst
|
||||
# ^^ source.typst markup.math.typst variable.other.readwrite.typst
|
||||
# ^ source.typst markup.math.typst markup.content.brace.typst
|
||||
# ^ source.typst markup.math.typst punctuation.definition.string.end.math.typst
|
||||
# ^^^^^ source.typst
|
||||
# ^ source.typst markup.math.typst punctuation.definition.string.begin.math.typst
|
||||
# ^^^^ source.typst markup.math.typst
|
||||
# ^^^^^ source.typst markup.math.typst variable.other.readwrite.typst
|
||||
# ^ source.typst markup.math.typst punctuation.definition.string.end.math.typst
|
||||
>
|
Loading…
Add table
Add a link
Reference in a new issue