Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/vs/editor/browser/gpu/css/decorationCssRuleExtractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,13 @@ export class DecorationCssRuleExtractor extends Disposable {
}
return result;
}

/**
* Clears all cached CSS rules and CSS variable values. This should be called when the theme
* changes to ensure fresh values are computed.
*/
clear(): void {
this._ruleCache.clear();
this._cssVariableCache.clear();
}
}
8 changes: 8 additions & 0 deletions src/vs/editor/browser/gpu/viewGpuContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { IInstantiationService } from '../../../platform/instantiation/common/in
import { TextureAtlas } from './atlas/textureAtlas.js';
import { IConfigurationService } from '../../../platform/configuration/common/configuration.js';
import { INotificationService, IPromptChoice, Severity } from '../../../platform/notification/common/notification.js';
import { IThemeService } from '../../../platform/theme/common/themeService.js';
import { GPULifecycle } from './gpuDisposable.js';
import { ensureNonNullable, observeDevicePixelDimensions } from './gpuUtils.js';
import { RectangleRenderer } from './rectangleRenderer.js';
Expand Down Expand Up @@ -82,6 +83,7 @@ export class ViewGpuContext extends Disposable {
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@INotificationService private readonly _notificationService: INotificationService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IThemeService private readonly _themeService: IThemeService,
) {
super();

Expand Down Expand Up @@ -124,6 +126,12 @@ export class ViewGpuContext extends Disposable {
this.devicePixelRatio = dprObs;
this._register(runOnChange(this.devicePixelRatio, () => ViewGpuContext.atlas?.clear()));

// Clear decoration CSS caches when theme changes as CSS variables may have different values
this._register(this._themeService.onDidColorThemeChange(() => {
ViewGpuContext.decorationCssRuleExtractor.clear();
ViewGpuContext.atlas?.clear();
}));

const canvasDevicePixelDimensions = observableValue(this, { width: this.canvas.domNode.width, height: this.canvas.domNode.height });
this._register(observeDevicePixelDimensions(
this.canvas.domNode,
Expand Down
Loading