You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parseJsonc changes string values that contain ",}" or ",]" #2
parseJsonc reads VS Code themes (from .vsix packages and local theme files). It removes trailing commas with a regex over the whole text, including inside strings (jsonc.ts#L23), so a string value that contains ,} or ,] gets changed:
Remove trailing commas only outside strings. The function already walks the text character by character and knows when it's inside a string (lines 6–22), so that loop is a good place to drop a comma whose next non-whitespace character is } or ], instead of the regex at the end.
Keep what works today: comments, // inside strings and [1, 2,] (existing test), and stripping a leading BOM.
Add test cases for the example above and for a BOM.
Test:pnpm test packages/themes and pnpm typecheck.
I reproduced the JSONC corruption in #2 and have a tested fix prepared.
The problem is the final out.replace(/,(\s*[}\]])/g, '$1'): it also matches ,} and ,] inside quoted strings. I moved trailing-comma removal into the existing character scan, on } / ] only when outside a string, after the comment-removal step. This also preserves commas before closing delimiters when comments intervene.
Added regression cases for literal ,} / ,] strings, escaped quotes, // inside strings, comments around trailing commas, and a leading BOM.
Verification on the local patch: pnpm test packages/themes (10 passing), pnpm typecheck (pass), full pnpm test (397 passing, 4 intentionally skipped). No dependency changes.
I have not opened a PR yet because my GitHub integration currently cannot create a fork/branch in this repository (403). The fix and tests are committed locally; I'll open a normal fork PR when write access is available.
Activity
bconnnnn commentedon Oct 16, 2026
I reproduced the JSONC corruption in #2 and have a tested fix prepared.
The problem is the final
out.replace(/,(\s*[}\]])/g, '$1'): it also matches,}and,]inside quoted strings. I moved trailing-comma removal into the existing character scan, on}/]only when outside a string, after the comment-removal step. This also preserves commas before closing delimiters when comments intervene.Added regression cases for literal
,}/,]strings, escaped quotes,//inside strings, comments around trailing commas, and a leading BOM.Verification on the local patch:
pnpm test packages/themes(10 passing),pnpm typecheck(pass), fullpnpm test(397 passing, 4 intentionally skipped). No dependency changes.I have not opened a PR yet because my GitHub integration currently cannot create a fork/branch in this repository (403). The fix and tests are committed locally; I'll open a normal fork PR when write access is available.