Skip to content

workbenchThemeService.setColorTheme disposes themingParticipantChangeListener  #27097

Closed

Description

I am building a component that is lazily loaded (and therefore lazily calls registerThemingParticipant). The callback passed in to registerThemingParticipant is never getting called though and it seems like this is because workbenchThemeService.setColorTheme disposes any previous themingParticipantChangeListener and does not add it back for some code paths.

It looks like setColorTheme assumes that applyTheme will add back the listener here, but there are multiple code paths in setColorTheme that neither call setColorTheme nor add back the listener.

The specific case I am hitting is
https://sourcegraph.com/github.com/Microsoft/vscode/-/blob/src/vs/workbench/services/themes/electron-browser/workbenchThemeService.ts#L411

if (themeId === this.currentColorTheme.id && !this.currentColorTheme.isLoaded && this.currentColorTheme.hasEqualData(themeData)) {
	// the loaded theme is identical to the perisisted theme. Don't need to send an event.
	this.currentColorTheme = themeData;
	themeData.setCustomColors(this.colorCustomizations);
	return TPromise.as(themeData);
}

When this case is hit, the listener is never re-registered, so subsequent calls to registerThemingParticipant will have no effect.

Activity

  1. added
    bug
    themes
    on May 23, 2017
  2. sandy081 commented on Jun 1, 2017

    @sandy081
    Member

    Martin Aeschlimann (@aeschli) I do not see this is an extension API.. are there any steps to verify this?

  3. aeschli commented on Jun 1, 2017

    @aeschli
    Contributor

    No, its just in code, no need to verify

  4. sandy081 commented on Jun 1, 2017

    @sandy081
    Member

    Adding verified tag so that it wont be seen in the to verify list

  5. locked and limited conversation to collaborators on Nov 18, 2017
  6. added a commit that references this issue on Sep 6, 2026
    319f30b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugthemesverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions