Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode: add support for valueSelection in InputBox #12050

10 changes: 10 additions & 0 deletions packages/plugin-ext/src/plugin/quick-open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ export class InputBoxExt extends QuickInputExt implements theia.InputBox {

private _password: boolean;
private _prompt: string | undefined;
private _valueSelection: readonly [number, number] | undefined;
private _validationMessage: string | undefined;

constructor(
Expand Down Expand Up @@ -576,6 +577,15 @@ export class InputBoxExt extends QuickInputExt implements theia.InputBox {
this.update({ prompt });
}

get valueSelection(): readonly [number, number] | undefined {
return this._valueSelection;
}

set valueSelection(valueSelection: readonly [number, number] | undefined) {
this._valueSelection = valueSelection;
this.update({ valueSelection });
}

get validationMessage(): string | undefined {
return this._validationMessage;
}
Expand Down
11 changes: 11 additions & 0 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5377,6 +5377,17 @@ export module '@theia/plugin' {
*/
password: boolean;

/**
* Selection range in the input value. Defined as tuple of two number where the
* first is the inclusive start index and the second the exclusive end index. When `undefined` the whole
* pre-filled value will be selected, when empty (start equals end) only the cursor will be set,
* otherwise the defined range will be selected.
*
* This property does not get updated when the user types or makes a selection,
* but it can be updated by the extension.
*/
valueSelection: readonly [number, number] | undefined;
paul-marechal marked this conversation as resolved.
Show resolved Hide resolved

/**
* An event signaling when the value has changed.
*/
Expand Down