diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index 9a8a943ed8..bfc552aae6 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -39,12 +39,17 @@ contexts: braces: - match: \{ scope: punctuation.definition.group.brace.begin.latex - push: - - meta_scope: meta.group.brace.latex - - match: \} - scope: punctuation.definition.group.brace.end.latex - pop: true - - include: main + push: brace-group-body + + brace-group-body: + - meta_scope: meta.group.brace.latex + - include: brace-group-end + - include: main + + brace-group-end: + - match: \} + scope: punctuation.definition.group.brace.end.latex + pop: true # these are used to identify arguments in commands general-optional-arguments: diff --git a/LaTeX/TeX.sublime-syntax b/LaTeX/TeX.sublime-syntax index 255b19cf03..a773088707 100644 --- a/LaTeX/TeX.sublime-syntax +++ b/LaTeX/TeX.sublime-syntax @@ -154,10 +154,17 @@ contexts: braces: - match: \{ scope: punctuation.definition.group.brace.begin.tex - push: - - meta_scope: meta.group.brace.tex - - include: brace-group-end - - include: main + push: brace-group-body + + brace-group-body: + - meta_scope: meta.group.brace.tex + - include: brace-group-end + - include: main + + brace-group-end: + - match: \} + scope: punctuation.definition.group.brace.end.tex + pop: true # within macros, it is possible that only part of some nested struture # is present. To prevent this from causing problems, here we only match @@ -383,12 +390,6 @@ contexts: - match: (?=\S) pop: true - # matches a closing brace and pops the context - brace-group-end: - - match: \} - scope: punctuation.definition.group.brace.end.tex - pop: true - immediately-pop: - match: '' pop: true