diff --git a/packages/plugin-ext/src/plugin/quick-open.ts b/packages/plugin-ext/src/plugin/quick-open.ts index a920926e1e2d6..12ef3a1e67492 100644 --- a/packages/plugin-ext/src/plugin/quick-open.ts +++ b/packages/plugin-ext/src/plugin/quick-open.ts @@ -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( @@ -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; } diff --git a/packages/plugin/src/theia.d.ts b/packages/plugin/src/theia.d.ts index 12ac09beb6562..517c288dc79ae 100644 --- a/packages/plugin/src/theia.d.ts +++ b/packages/plugin/src/theia.d.ts @@ -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; + /** * An event signaling when the value has changed. */