From 6f5beeed53e94cc14e8090f3670b7094412ca305 Mon Sep 17 00:00:00 2001 From: yogeshwaran-c Date: Wed, 25 Mar 2026 21:37:37 +0530 Subject: [PATCH 1/5] fix: support multiline single-dollar math highlighting in markdown The math_inline_block pattern only matched $$ (double dollar) for multiline math expressions. Single $ math that spans multiple lines was not highlighted. Change the begin pattern to match 1 or 2 dollar signs and use a backreference in the end pattern to match the same delimiter. Also fix capture group references from "2" to "1". --- .../markdown-math/syntaxes/md-math-inline.tmLanguage.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json b/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json index 02fe223665340..cc9e7ff3a951b 100644 --- a/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json +++ b/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json @@ -56,15 +56,15 @@ "math_inline_block": { "name": "markup.math.inline.markdown", "contentName": "meta.embedded.math.markdown", - "begin": "(?<=\\s|^)(\\${2})", + "begin": "(?<=\\s|^)(\\${1,2})", "beginCaptures": { - "2": { + "1": { "name": "punctuation.definition.math.begin.markdown" } }, - "end": "(\\${2})(?=\\s|$)", + "end": "(\\1)(?=\\s|$)", "endCaptures": { - "2": { + "1": { "name": "punctuation.definition.math.end.markdown" } }, From 550f6e07ac80d25f5259f3314950460e7da69cab Mon Sep 17 00:00:00 2001 From: yogeshwaran-c Date: Wed, 25 Mar 2026 21:38:59 +0530 Subject: [PATCH 2/5] fix: show correct version info in TypeScript version picker The 'Use VS Code's Version' item in the TypeScript version picker was using `defaultVersion` which could return a user-configured global TypeScript SDK path instead of the actual bundled version. This caused the picker to display incorrect version info and path when `typescript.tsdk` was configured. Additionally, the active indicator (bullet) used a heuristic based on `useWorkspaceTsdkSetting` rather than actually comparing the current version to the bundled version. Fix by using `bundledVersion` directly and comparing against `currentVersion` for the active indicator, consistent with how the workspace version item already works. Fixes #263226 --- .../src/tsServer/versionManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/typescript-language-features/src/tsServer/versionManager.ts b/extensions/typescript-language-features/src/tsServer/versionManager.ts index 8d99637dadcd6..35efd16867de2 100644 --- a/extensions/typescript-language-features/src/tsServer/versionManager.ts +++ b/extensions/typescript-language-features/src/tsServer/versionManager.ts @@ -106,9 +106,9 @@ export class TypeScriptVersionManager extends Disposable { } private getBundledPickItem(): QuickPickItem { - const bundledVersion = this.versionProvider.defaultVersion; + const bundledVersion = this.versionProvider.bundledVersion; return { - label: (!this.useWorkspaceTsdkSetting || !vscode.workspace.isTrusted + label: (this.currentVersion.eq(bundledVersion) ? '• ' : '') + vscode.l10n.t("Use VS Code's Version"), description: bundledVersion.displayName, From b87a6a0e0d454c584864c0e2d60abaa3cc468edd Mon Sep 17 00:00:00 2001 From: yogeshwaran-c Date: Fri, 27 Mar 2026 20:34:45 +0530 Subject: [PATCH 3/5] fix: remove unrelated changes and add colorize tests for multiline math Remove the accidentally included TypeScript version picker changes. Add tokenizer test fixtures for multiline single-dollar math highlighting to cover the grammar fix for #223545. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../src/tsServer/versionManager.ts | 4 ++-- .../test/colorize-fixtures/md-math.md | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/extensions/typescript-language-features/src/tsServer/versionManager.ts b/extensions/typescript-language-features/src/tsServer/versionManager.ts index 35efd16867de2..8d99637dadcd6 100644 --- a/extensions/typescript-language-features/src/tsServer/versionManager.ts +++ b/extensions/typescript-language-features/src/tsServer/versionManager.ts @@ -106,9 +106,9 @@ export class TypeScriptVersionManager extends Disposable { } private getBundledPickItem(): QuickPickItem { - const bundledVersion = this.versionProvider.bundledVersion; + const bundledVersion = this.versionProvider.defaultVersion; return { - label: (this.currentVersion.eq(bundledVersion) + label: (!this.useWorkspaceTsdkSetting || !vscode.workspace.isTrusted ? '• ' : '') + vscode.l10n.t("Use VS Code's Version"), description: bundledVersion.displayName, diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md b/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md index 5010968bb7a13..fcf1479594683 100644 --- a/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md @@ -171,3 +171,27 @@ x $12.45 $$ \% Should not be highlighted $$ + + + +$\mu = e^{\mu_L + \sigma_L^2} +\land \sigma_2 = (e^{\sigma_L^2} - 1) e^{2\mu_L + \sigma_L^2}$ + +**md** + +$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} +\text{ where } a \neq 0$ + +**md** + + + +$$\alpha +\beta$$ + +**md** + +$\gamma +\delta$ + +**md** From 8547ee33a47640aa9575f1006e365408fcf2c326 Mon Sep 17 00:00:00 2001 From: yogeshwaran-c Date: Mon, 4 May 2026 08:36:13 +0530 Subject: [PATCH 4/5] Tighten multiline math begin to require non-whitespace; drop ungenerated fixtures --- .../syntaxes/md-math-inline.tmLanguage.json | 2 +- .../test/colorize-fixtures/md-math.md | 22 ------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json b/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json index cc9e7ff3a951b..2bb715e146fa6 100644 --- a/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json +++ b/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json @@ -56,7 +56,7 @@ "math_inline_block": { "name": "markup.math.inline.markdown", "contentName": "meta.embedded.math.markdown", - "begin": "(?<=\\s|^)(\\${1,2})", + "begin": "(?<=\\s|^)(\\${1,2})(?=\\S)", "beginCaptures": { "1": { "name": "punctuation.definition.math.begin.markdown" diff --git a/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md b/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md index fcf1479594683..5dd2bd222d7f0 100644 --- a/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md +++ b/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md @@ -172,26 +172,4 @@ x $12.45 $$ \% Should not be highlighted $$ - - -$\mu = e^{\mu_L + \sigma_L^2} -\land \sigma_2 = (e^{\sigma_L^2} - 1) e^{2\mu_L + \sigma_L^2}$ - -**md** - -$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} -\text{ where } a \neq 0$ - -**md** - - - -$$\alpha -\beta$$ - -**md** - -$\gamma -\delta$ - **md** From 98017d8134dee04a2cc0c6a8e844d7171416e8d2 Mon Sep 17 00:00:00 2001 From: yogeshwaran-c Date: Wed, 6 May 2026 06:47:48 +0530 Subject: [PATCH 5/5] Use digit guards (currency/price) instead of \S to keep $$ at end of line --- .../markdown-math/syntaxes/md-math-inline.tmLanguage.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json b/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json index 2bb715e146fa6..5f8069aa128e2 100644 --- a/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json +++ b/extensions/markdown-math/syntaxes/md-math-inline.tmLanguage.json @@ -56,7 +56,7 @@ "math_inline_block": { "name": "markup.math.inline.markdown", "contentName": "meta.embedded.math.markdown", - "begin": "(?<=\\s|^)(\\${1,2})(?=\\S)", + "begin": "(?<=\\s|^)(\\${1,2})(?!\\d)(?!\\s+\\d)", "beginCaptures": { "1": { "name": "punctuation.definition.math.begin.markdown"