From cd808e5e58b869c49f32f13d3dd68706ee6d6e5e Mon Sep 17 00:00:00 2001 From: Xie Jingyi Date: Tue, 19 Dec 2023 03:17:56 +0800 Subject: [PATCH] Defer onDidStyleChange to Repl being visible (#200473) Co-authored-by: Rob Lourens --- src/vs/workbench/contrib/debug/browser/repl.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vs/workbench/contrib/debug/browser/repl.ts b/src/vs/workbench/contrib/debug/browser/repl.ts index 98c46f89e7855..3ca7c13cffdae 100644 --- a/src/vs/workbench/contrib/debug/browser/repl.ts +++ b/src/vs/workbench/contrib/debug/browser/repl.ts @@ -108,6 +108,7 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget { private scopedInstantiationService!: IInstantiationService; private replElementsChangeListener: IDisposable | undefined; private styleElement: HTMLStyleElement | undefined; + private styleChangedWhenInvisible: boolean = false; private completionItemProvider: IDisposable | undefined; private modelChangeListener: IDisposable = Disposable.None; private filter: ReplFilter; @@ -199,6 +200,10 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget { this.replInput.setModel(this.model); this.updateInputDecoration(); this.refreshReplElements(true); + if (this.styleChangedWhenInvisible) { + this.styleChangedWhenInvisible = false; + this.onDidStyleChange(); + } } })); this._register(this.configurationService.onDidChangeConfiguration(e => { @@ -353,6 +358,10 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget { } private onDidStyleChange(): void { + if (!this.isVisible()) { + this.styleChangedWhenInvisible = true; + return; + } if (this.styleElement) { this.replInput.updateOptions({ fontSize: this.replOptions.replConfiguration.fontSize,