From f45966337630f9a150be857cc8a8c2dbcabceebd Mon Sep 17 00:00:00 2001 From: ngc92 <7938269+ngc92@users.noreply.github.com> Date: Sat, 26 Nov 2022 18:52:21 +0200 Subject: [PATCH] [LaTeX] Fixups for command names (#3594) --- LaTeX/LaTeX.sublime-syntax | 10 +++++----- LaTeX/syntax_test_latex.tex | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/LaTeX/LaTeX.sublime-syntax b/LaTeX/LaTeX.sublime-syntax index e131868e03..25031cd6bc 100644 --- a/LaTeX/LaTeX.sublime-syntax +++ b/LaTeX/LaTeX.sublime-syntax @@ -167,7 +167,7 @@ contexts: latex-newcommand-bare-commandname: - clear_scopes: 1 - meta_scope: meta.function.identifier.latex - - match: (\\){{letter}}+ + - match: (\\){{cmdname}} scope: entity.name.newcommand.latex captures: 1: punctuation.definition.backslash.latex @@ -179,7 +179,7 @@ contexts: - clear_scopes: 1 - meta_scope: meta.function.identifier.latex - include: brace-group-end - - match: (\\){{letter}}+ + - match: (\\){{cmdname}} scope: entity.name.newcommand.latex captures: 1: punctuation.definition.backslash.latex @@ -201,14 +201,14 @@ contexts: - meta_scope: meta.function.body.latex # but in principle, a single token is also valid, # thus either a command sequence ... - - match: (\\){{letter}}+ + - match: (\\){{cmdname}} scope: support.function.general.latex captures: 1: punctuation.definition.backslash.latex pop: 1 - # or a single, potentially escaped character. no further effort at + # or a single character. no further effort at # differentiation here - - match: (\\)?\S\b + - match: \S\b scope: constant.character.escape.latex captures: 1: punctuation.definition.backslash.latex diff --git a/LaTeX/syntax_test_latex.tex b/LaTeX/syntax_test_latex.tex index e4f2e94de7..af543496aa 100644 --- a/LaTeX/syntax_test_latex.tex +++ b/LaTeX/syntax_test_latex.tex @@ -225,6 +225,14 @@ \alpha % ^^^^^^ support.function.general.latex +\newcommand\"{quote} +%^^^^^^^^^^ meta.function.latex keyword.declaration.function.latex storage.modifier.newcommand.latex +% ^^ meta.function.identifier.latex entity.name.newcommand.latex +% ^^^^^^^ meta.function.body.tex meta.group.brace.tex +% ^ punctuation.definition.backslash.latex +% ^ punctuation.definition.group.brace.begin.tex +% ^ punctuation.definition.group.brace.end.tex + \newcommandprefix %^^^^^^^^^^^^^^^^ support.function.general.latex