From 2dee9053613a989f5945572363b81deab4098d2a Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Fri, 15 Nov 2024 09:03:16 +0000 Subject: [PATCH] Merge pull request #21535 from overleaf/ae-grammar-grouping * Move $MathContainer grouping into the LaTeX grammar * Remove $Environment grouping from NodeProp.group GitOrigin-RevId: 96c74edd818bf84acf4b492702864c3c71a9bee3 --- .../source-editor/languages/latex/latex-language.ts | 9 --------- .../js/features/source-editor/lezer-latex/latex.grammar | 6 +++--- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts b/services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts index 968c31487f..aa19af3497 100644 --- a/services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts +++ b/services/web/frontend/js/features/source-editor/languages/latex/latex-language.ts @@ -163,17 +163,8 @@ export const LaTeXLanguage = LRLanguage.define({ ) { types.push('$TextArgument') } - } else if ( - type.name.endsWith('Environment') && - !['NewEnvironment', 'RenewEnvironment'].includes(type.name) - ) { - types.push('$Environment') } else if (type.name.endsWith('Brace')) { types.push('$Brace') - } else if ( - ['BracketMath', 'ParenMath', 'DollarMath'].includes(type.name) - ) { - types.push('$MathContainer') } if (type.name in typeMap) { diff --git a/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar b/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar index c9c155deca..578ef52bdb 100644 --- a/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar +++ b/services/web/frontend/js/features/source-editor/lezer-latex/latex.grammar @@ -692,7 +692,7 @@ NonEmptyGroup { /// MATH MODE -DollarMath { +DollarMath[@isGroup="$MathContainer"] { Dollar (InlineMath | DisplayMath) Dollar } @@ -714,7 +714,7 @@ CloseParenMath[openedBy=OpenParenMath] { } // alternative syntax \( math \) for inline math, it is the same as $ math $ -ParenMath { +ParenMath[@isGroup="$MathContainer"] { OpenParenMath Math? CloseParenMath @@ -729,7 +729,7 @@ CloseBracketMath[openedBy=OpenBracketMath] { } // alternative syntax \[ math \] for display math, it is the same as $$ math $$ -BracketMath { +BracketMath[@isGroup="$MathContainer"] { OpenBracketMath Math? CloseBracketMath