Skip to content

Commit

Permalink
fixes #118694
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Mar 11, 2021
1 parent 37a826f commit 3fb39ad
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/vs/workbench/browser/parts/editor/untitledHint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<void> {
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) {
Expand Down

0 comments on commit 3fb39ad

Please sign in to comment.