Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 9, 2026

The CSS variable cache in DecorationCssRuleExtractor persisted across theme changes, returning stale values since CSS variables resolve differently per theme.

Changes

  • Added clear() method to DecorationCssRuleExtractor: Invalidates both _ruleCache and _cssVariableCache
  • Subscribe to theme changes in ViewGpuContext: Calls decorationCssRuleExtractor.clear() on onDidColorThemeChange, following the pattern established by TextureAtlas
// In ViewGpuContext constructor
this._register(this._themeService.onDidColorThemeChange(() => {
	ViewGpuContext.decorationCssRuleExtractor.clear();
	ViewGpuContext.atlas?.clear();
}));

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] WIP address feedback on caching resolved CSS variables Clear CSS cache on theme change to prevent stale CSS variable values Jan 9, 2026
Copilot AI requested a review from rzhao271 January 9, 2026 21:57
@rzhao271 rzhao271 requested a review from Tyriar January 9, 2026 22:38
Base automatically changed from tyriar/286833 to main January 9, 2026 22:42
@rzhao271 rzhao271 marked this pull request as ready for review January 9, 2026 22:45
Copilot AI review requested due to automatic review settings January 9, 2026 22:45
@vs-code-engineering vs-code-engineering bot added this to the January 2026 milestone Jan 9, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where CSS variable values were cached across theme changes in the GPU-accelerated editor rendering, causing stale decoration styles to be used when users switched themes.

Key Changes

  • Added a clear() method to DecorationCssRuleExtractor that invalidates both the CSS rule cache and CSS variable cache
  • Subscribed to theme changes in ViewGpuContext to clear both the decoration CSS caches and texture atlas when the theme changes

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vs/editor/browser/gpu/css/decorationCssRuleExtractor.ts Added clear() method to invalidate cached CSS rules and CSS variable values
src/vs/editor/browser/gpu/viewGpuContext.ts Injected IThemeService and subscribed to onDidColorThemeChange to clear decoration CSS caches and atlas

@Tyriar Tyriar enabled auto-merge January 10, 2026 00:42
@Tyriar Tyriar merged commit 63024b7 into main Jan 10, 2026
22 checks passed
@Tyriar Tyriar deleted the copilot/sub-pr-286838 branch January 10, 2026 01:02
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.

3 participants