fix(themes): sync preferred theme settings when workbench.colorTheme changes#309182
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
fix(themes): sync preferred theme settings when workbench.colorTheme changes#309182yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When the user changes `workbench.colorTheme`, also update `workbench.preferredDarkColorTheme` or `workbench.preferredLightColorTheme` so that the 'Toggle between Light/Dark Themes' command returns to the user's most recently used theme instead of reverting to the default. Fixes microsoft#305685
f15757b to
1e7096e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upstream fix for #305685
Problem
Using Toggle between Light/Dark Themes resets the theme to VS Code defaults (
VSCode Dark/VSCode Light) instead of returning to the user's previously-selected theme.Root Cause
The toggle command reads
workbench.preferredDarkColorTheme/workbench.preferredLightColorThemeto decide which theme to apply. If the user never explicitly configured those settings they contain the default value, so the toggle always switches to the default rather than the theme the user was using.Fix
In
installConfigurationListener, whenworkbench.colorThemechanges and auto-detect is not active, keep the matching preferred-theme setting in sync:workbench.preferredDarkColorThemeto match.workbench.preferredLightColorThemeto match.This ensures the toggle always returns to the user's most recently used dark or light theme. The guard
current !== newSettingIdprevents redundant writes (e.g. when the toggle itself setsworkbench.colorTheme).