[GH-ISSUE #31] fix: prevent VS Code startup crash ("Unexpected token ','") after Custom UI Style patch #27

Open
opened 2026-05-06 13:12:42 +02:00 by BreizhHardware · 1 comment

Originally created by @msirprism on GitHub (Feb 16, 2026).
Original GitHub issue: https://github.com/bwya77/vscode-dark-islands/issues/31

PR Title
fix: prevent VS Code startup crash ("Unexpected token ','") after Custom UI Style patch

PR Description (ready to paste)

Summary

This PR fixes a startup crash that some users hit right after running the theme bootstrap:

A JavaScript error occurred in the main process
Uncaught Exception: SyntaxError: Unexpected token ','

Root Cause

The subframe7536.custom-ui-style extension patches VS Code's out/main.js.

Its patch logic appends custom-ui-style.electron options to this token:

experimentalDarkMode:!0

When custom-ui-style.electron is empty, the generated patch can produce:

experimentalDarkMode:!0,,

That double comma is invalid JavaScript and crashes VS Code before UI startup.

What this PR changes

  • Adds a safe non-empty default in generated user settings:
    • "custom-ui-style.electron": { "backgroundColor": "#121216" }
  • Adds troubleshooting docs for users already affected.

Recovery steps for users already broken

  1. Quit VS Code completely.

  2. Edit VS Code's patched main file and replace:

    • experimentalDarkMode:!0,,
    • with experimentalDarkMode:!0,
  3. Ensure settings.json contains:

    "custom-ui-style.electron": {
      "backgroundColor": "#121216"
    }
    
    
  4. Reopen VS Code.

Quick macOS command (repair)

MAIN="/Applications/Visual Studio Code.app/Contents/Resources/app/out/main.js"
perl -0pi -e 's/experimentalDarkMode:!0,,/experimentalDarkMode:!0,/g' "$MAIN"

Validation

  • node --check .../out/main.js returns no syntax error.
  • code --version runs successfully again.
Image
Originally created by @msirprism on GitHub (Feb 16, 2026). Original GitHub issue: https://github.com/bwya77/vscode-dark-islands/issues/31 PR Title fix: prevent VS Code startup crash ("Unexpected token ','") after Custom UI Style patch PR Description (ready to paste) ## Summary This PR fixes a startup crash that some users hit right after running the theme bootstrap: > A JavaScript error occurred in the main process > Uncaught Exception: SyntaxError: Unexpected token ',' ## Root Cause The `subframe7536.custom-ui-style` extension patches VS Code's `out/main.js`. Its patch logic appends `custom-ui-style.electron` options to this token: `experimentalDarkMode:!0` When `custom-ui-style.electron` is empty, the generated patch can produce: `experimentalDarkMode:!0,,` That double comma is invalid JavaScript and crashes VS Code before UI startup. ## What this PR changes - Adds a safe non-empty default in generated user settings: - `"custom-ui-style.electron": { "backgroundColor": "#121216" }` - Adds troubleshooting docs for users already affected. ## Recovery steps for users already broken 1. Quit VS Code completely. 2. Edit VS Code's patched main file and replace: - `experimentalDarkMode:!0,,` - with `experimentalDarkMode:!0,` 3. Ensure `settings.json` contains: ```json "custom-ui-style.electron": { "backgroundColor": "#121216" } 4. Reopen VS Code. ## Quick macOS command (repair) MAIN="/Applications/Visual Studio Code.app/Contents/Resources/app/out/main.js" perl -0pi -e 's/experimentalDarkMode:!0,,/experimentalDarkMode:!0,/g' "$MAIN" ## Validation - node --check .../out/main.js returns no syntax error. - code --version runs successfully again. <img width="2160" height="1392" alt="Image" src="https://github.com/user-attachments/assets/ceede691-176a-477f-adb5-f1cdd7f14dda" />
Author
Owner

@subframe7536 commented on GitHub (Feb 16, 2026):

Custom UI Style extension author here, it should be fixed in next release soon.

<!-- gh-comment-id:3908428661 --> @subframe7536 commented on GitHub (Feb 16, 2026): Custom UI Style extension author here, it should be fixed in next release soon.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vscode-dark-islands#27
No description provided.