Repository: microsoft/vscode
File: src/vs/base/browser/ui/inputbox/inputBox.ts (TypeScript)

Code before:
			// from DOM to ScrollableElement
			this._register(onAnchoredSelectionChange(this.updateScrollDimensions, this));
			this._register(this.onDidHeightChange(this.updateScrollDimensions, this));
		} else {
			this.input.type = this.options.type || 'text';
			this.input.setAttribute('wrap', 'off');
		}

		if (this.ariaLabel) {
			this.input.setAttribute('aria-label', this.ariaLabel);
		}

		if (this.placeholder && !this.options.showPlaceholderOnFocus) {
			this.setPlaceHolder(this.placeholder);
		}

		if (this.tooltip) {
			this.setTooltip(this.tooltip);
		}

		this.oninput(this.input, () => this.onValueChange());
		this.onblur(this.input, () => this.onBlur());
		this.onfocus(this.input, () => this.onFocus());

		if (this.options.hideHoverOnKeyDown) {
			this._register(dom.addDisposableListener(this.input, dom.EventType.KEY_DOWN, () => {
				getBaseLayerHoverDelegate().hideHover();
			}));
		}

		this._register(this.ignoreGesture(this.input));

		setTimeout(() => this.updateMirror(), 0);

		// Support actions
		if (this.options.actions) {
			this.actionbar = this._register(new ActionBar(this.element, {
				actionViewItemProvider: this.options.actionViewItemProvider
			}));
			this.actionbar.push(this.options.actions, { icon: true, label: false });
		}

		this.applyStyles();
	}

	public setActions(actions: ReadonlyArray<IAction> | undefined, actionViewItemProvider?: IActionViewItemProvider): void {
		if (this.actionbar) {
			this.actionbar.clear();
			if (actions) {
				this.actionbar.push(actions, { icon: true, label: false });
			}

Review comment (suggestion):
We already have an `onValueChange` function that runs when what is in the input changes. This feels like a good approximation without needing to add another event.

Additionally, rather than doing this, `getBaseLayerHoverDelegate().hideHover();` we already have a `this.hover.value` which we could probably just dispose of instead.

Code after:
			// from DOM to ScrollableElement
			this._register(onAnchoredSelectionChange(this.updateScrollDimensions, this));
			this._register(this.onDidHeightChange(this.updateScrollDimensions, this));
		} else {
			this.input.type = this.options.type || 'text';
			this.input.setAttribute('wrap', 'off');
		}

		if (this.ariaLabel) {
			this.input.setAttribute('aria-label', this.ariaLabel);
		}

		if (this.placeholder && !this.options.showPlaceholderOnFocus) {
			this.setPlaceHolder(this.placeholder);
		}

		if (this.tooltip) {
			this.setTooltip(this.tooltip);
		}

		this.oninput(this.input, () => this.onValueChange());
		this.onblur(this.input, () => this.onBlur());
		this.onfocus(this.input, () => this.onFocus());

		this._register(this.ignoreGesture(this.input));

		setTimeout(() => this.updateMirror(), 0);

		// Support actions
		if (this.options.actions) {
			this.actionbar = this._register(new ActionBar(this.element, {
				actionViewItemProvider: this.options.actionViewItemProvider
			}));
			this.actionbar.push(this.options.actions, { icon: true, label: false });
		}

		this.applyStyles();
	}

	public setActions(actions: ReadonlyArray<IAction> | undefined, actionViewItemProvider?: IActionViewItemProvider): void {
		if (this.actionbar) {
			this.actionbar.clear();
			if (actions) {
				this.actionbar.push(actions, { icon: true, label: false });
			}
		} else if (actions) {
			this.actionbar = this._register(new ActionBar(this.element, {
				actionViewItemProvider: actionViewItemProvider ?? this.options.actionViewItemProvider
			}));
			this.actionbar.push(actions, { icon: true, label: false });
		}