diff --git a/src/vs/platform/quickinput/browser/quickInput.ts b/src/vs/platform/quickinput/browser/quickInput.ts index a4c29452ea4..485370872ce 100644 --- a/src/vs/platform/quickinput/browser/quickInput.ts +++ b/src/vs/platform/quickinput/browser/quickInput.ts @@ -156,8 +156,6 @@ export abstract class QuickInput extends Disposable implements IQuickInput { protected _visible = observableValue('visible', false); private _title: string | undefined; private _description: string | undefined; - private _widget: HTMLElement | undefined; - private _widgetUpdated = false; private _steps: number | undefined; private _totalSteps: number | undefined; private _enabled = true; @@ -213,21 +211,6 @@ export abstract class QuickInput extends Disposable implements IQuickInput { this.update(); } - get widget() { - return this._widget; - } - - set widget(widget: unknown | undefined) { - if (!(dom.isHTMLElement(widget))) { - return; - } - if (this._widget !== widget) { - this._widget = widget; - this._widgetUpdated = true; - this.update(); - } - } - get step() { return this._steps; } @@ -417,14 +400,6 @@ export abstract class QuickInput extends Disposable implements IQuickInput { if (this.ui.description2.textContent !== description) { this.ui.description2.textContent = description; } - if (this._widgetUpdated) { - this._widgetUpdated = false; - if (this._widget) { - dom.reset(this.ui.widget, this._widget); - } else { - dom.reset(this.ui.widget); - } - } if (this.busy && !this.busyDelay) { this.busyDelay = new TimeoutTimer(); this.busyDelay.setIfNotSet(() => { @@ -1358,17 +1333,37 @@ export class InputBox extends QuickInput implements IInputBox { export class QuickWidget extends QuickInput implements IQuickWidget { readonly type = QuickInputType.QuickWidget; + private _widget: HTMLElement | undefined; + private _widgetUpdated = false; + + get widget() { + return this._widget; + } + + set widget(widget: HTMLElement | undefined) { + if (this._widget !== widget) { + this._widget = widget; + this._widgetUpdated = true; + this.update(); + } + } + protected override update() { if (!this.visible) { return; } - - const visibilities: Visibilities = { + this.ui.setVisibilities({ title: !!this.title || !!this.step || !!this.titleButtons.length, description: !!this.description || !!this.step - }; - - this.ui.setVisibilities(visibilities); + }); + if (this._widgetUpdated) { + this._widgetUpdated = false; + if (this._widget) { + dom.reset(this.ui.widget, this._widget); + } else { + dom.reset(this.ui.widget); + } + } super.update(); } } diff --git a/src/vs/platform/quickinput/common/quickInput.ts b/src/vs/platform/quickinput/common/quickInput.ts index 78930869688..03b76a939b2 100644 --- a/src/vs/platform/quickinput/common/quickInput.ts +++ b/src/vs/platform/quickinput/common/quickInput.ts @@ -313,12 +313,6 @@ export interface IQuickInput extends IDisposable { */ description: string | undefined; - /** - * An HTML widget rendered below the input. - * @deprecated Use an IQuickWidget instead. - */ - widget: any | undefined; - /** * The current step of the quick input rendered in the titlebar. */ @@ -390,10 +384,9 @@ export interface IQuickWidget extends IQuickInput { readonly type: QuickInputType.QuickWidget; /** - * Should be an HTMLElement (TODO: move this entire file into browser) - * @override + * A HTML element that will be rendered inside the quick input. */ - widget: any | undefined; + widget: HTMLElement | undefined; } export interface IQuickPickWillAcceptEvent {