Skip to content

fix(vscode): guard theme colors lookup so a non-standard palette can't crash activation - #13168

Open
bisma-nawaz wants to merge 2 commits into
continuedev:mainfrom
bisma-nawaz:fix-12947
Open

fix(vscode): guard theme colors lookup so a non-standard palette can't crash activation#13168
bisma-nawaz wants to merge 2 commits into
continuedev:mainfrom
bisma-nawaz:fix-12947

Conversation

@bisma-nawaz

Copy link
Copy Markdown

Description

Fixes #12947. Extension activation crashes with a non-standard color theme.

InlineTipManager.createSvgTooltipDecoration guarded only if (this.theme) and then read this.theme.colors["editor.background"]. When the active theme produces a Monaco theme whose colors map is undefined, that read throws TypeError: Cannot read properties of undefined (reading 'editor.background'), which propagates out of the field initializer and kills activation. The two this.theme?.colors["editor.foreground"] reads in createSvgTooltip have the same latent unsafe access.

This makes all three reads null-safe (this.theme?.colors?.[...]), so a theme without the standard colors falls back to the existing default instead of crashing.

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

before: TypeError on undefined colors / after: 2 passed

Tests

Added extensions/vscode/src/activation/InlineTipManager.vitest.ts, which exercises createSvgTooltipDecoration with a theme whose colors is undefined. Before the change it throws the editor.background TypeError; after, it does not throw (and the colors-present case still works). npx vitest run src/activation/InlineTipManager.vitest.ts: before = 1 failed, after = 2 passed.

@bisma-nawaz
bisma-nawaz requested a review from a team as a code owner August 20, 2026 23:20
@bisma-nawaz
bisma-nawaz requested review from sestinj and removed request for a team August 20, 2026 23:20
@github-actions

Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activation fails if there's a non-standard color palette in place.

1 participant