From 3fb39ad72d62938f9fc18b7cf85c129ee6a370d3 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 11 Mar 2021 15:07:47 +0100 Subject: [PATCH] fixes #118694 --- src/vs/workbench/browser/parts/editor/untitledHint.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/untitledHint.ts b/src/vs/workbench/browser/parts/editor/untitledHint.ts index 0ab99e716a989..ce498d0aca640 100644 --- a/src/vs/workbench/browser/parts/editor/untitledHint.ts +++ b/src/vs/workbench/browser/parts/editor/untitledHint.ts @@ -29,6 +29,7 @@ export class UntitledHintContribution implements IEditorContribution { private toDispose: IDisposable[]; private untitledHintContentWidget: UntitledHintContentWidget | undefined; private button: FloatingClickWidget | undefined; + private experimentTreatment: 'text' | 'button' | undefined; constructor( private editor: ICodeEditor, @@ -46,15 +47,17 @@ export class UntitledHintContribution implements IEditorContribution { this.update(); } })); - this.update(); + this.experimentService.getTreatment<'text' | 'button'>('untitledhint').then(treatment => { + this.experimentTreatment = treatment; + this.update(); + }); } - private async update(): Promise { + private update(): void { this.untitledHintContentWidget?.dispose(); this.button?.dispose(); - const experimentService = await this.experimentService.getTreatment<'text' | 'button'>('untitledhint'); const configValue = this.configurationService.getValue<'text' | 'button' | 'hidden'>(untitledHintSetting); - const untitledHintMode = configValue === 'hidden' ? configValue : (experimentService || configValue); + const untitledHintMode = configValue === 'hidden' ? configValue : (this.experimentTreatment || configValue); const model = this.editor.getModel(); if (model && model.uri.scheme === Schemas.untitled && model.getModeId() === PLAINTEXT_MODE_ID) {