From 393036e83fb4af129f8ad518f0ef233ce7c6ec2b Mon Sep 17 00:00:00 2001 From: Bartosz Antosik Date: Wed, 28 Feb 2018 22:13:26 +0100 Subject: [PATCH] LaTeX commands with nested curly braces improperly removed from spelling (#120) --- CHANGELOG.md | 3 ++- lib/parsers/latex.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8007725..cbb09eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ ## **2.1.24** released on 28th February 2018 -- **New:** LaTeX magic comments (`!TEX`) removed from spelling. +- **New:** LaTeX magic comments (`!TEX`) removed from spelling ([#120](https://github.com/bartosz-antosik/vscode-spellright/issues/120)). - **New:** Added spelling parser settings for LISP (comments & strings) source code files. +- **Change:** LaTeX commands with nested curly braces improperly removed from spelling ([#120](https://github.com/bartosz-antosik/vscode-spellright/issues/120)). ## **2.1.22** released on 26th February 2018 diff --git a/lib/parsers/latex.js b/lib/parsers/latex.js index 35fa40e..96e33a1 100644 --- a/lib/parsers/latex.js +++ b/lib/parsers/latex.js @@ -43,7 +43,7 @@ class LaTeX extends Parser.default { } // Remove commands - var re = /\\\w+\*?(\[[\s\S]*?\])*((\{|\()[\s\S]*?(\}|\)))*(\[[\s\S]*?\])*/g; + var re = /\\\w+\*?(\[[\s\S]*?\])*(\{(?:\{[^\}]*\}|[^\{\}])*\})/g; while (match = re.exec(text)) { //var replace = ' '.repeat(match[0].length); var replace = match[0].replace(/(?:[^\r\n]|\r(?!\n))/g, ' ');