diff --git a/src/vs/base/parts/quickinput/common/quickInput.ts b/src/vs/base/parts/quickinput/common/quickInput.ts index c3443a3180d..2b08cceb208 100644 --- a/src/vs/base/parts/quickinput/common/quickInput.ts +++ b/src/vs/base/parts/quickinput/common/quickInput.ts @@ -145,9 +145,9 @@ export interface IInputOptions { value?: string; /** - * the selection of value, default to the whole word + * the selection of value, default to the whole prefilled value */ - valueSelection?: [number, number]; + valueSelection?: readonly [number, number]; /** * the text to display underneath the input box @@ -164,6 +164,9 @@ export interface IInputOptions { */ password?: boolean; + /** + * an optional flag to not close the input on focus lost + */ ignoreFocusLost?: boolean; /** diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index e352a3bc53d..8c2ab9090c4 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -555,6 +555,8 @@ export interface TransferInputBox extends BaseTransferQuickInput { value?: string; + valueSelection?: Readonly<[number, number]>; + placeholder?: string; password?: boolean; @@ -569,7 +571,7 @@ export interface TransferInputBox extends BaseTransferQuickInput { export interface IInputBoxOptions { title?: string; value?: string; - valueSelection?: [number, number]; + valueSelection?: Readonly<[number, number]>; prompt?: string; placeHolder?: string; password?: boolean; diff --git a/src/vs/workbench/api/common/extHostQuickOpen.ts b/src/vs/workbench/api/common/extHostQuickOpen.ts index 6d7ab756c8c..afb34a578e7 100644 --- a/src/vs/workbench/api/common/extHostQuickOpen.ts +++ b/src/vs/workbench/api/common/extHostQuickOpen.ts @@ -687,6 +687,7 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx private _password = false; private _prompt: string | undefined; + private _valueSelection: readonly [number, number] | undefined; private _validationMessage: string | InputBoxValidationMessage | undefined; constructor(extension: IExtensionDescription, onDispose: () => void) { @@ -712,6 +713,15 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx this.update({ prompt }); } + get valueSelection() { + return this._valueSelection; + } + + set valueSelection(valueSelection: readonly [number, number] | undefined) { + this._valueSelection = valueSelection; + this.update({ valueSelection }); + } + get validationMessage() { return this._validationMessage; } diff --git a/src/vscode-dts/vscode.d.ts b/src/vscode-dts/vscode.d.ts index 045afad03cb..c346e7df8ea 100644 --- a/src/vscode-dts/vscode.d.ts +++ b/src/vscode-dts/vscode.d.ts @@ -2018,7 +2018,7 @@ declare module 'vscode' { /** * Selection of the pre-filled {@linkcode InputBoxOptions.value 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 - * word will be selected, when empty (start equals end) only the cursor will be set, + * pre-filled value will be selected, when empty (start equals end) only the cursor will be set, * otherwise the defined range will be selected. */ valueSelection?: [number, number]; @@ -11316,7 +11316,7 @@ declare module 'vscode' { value: string; /** - * Optional placeholder in the filter text. + * Optional placeholder shown in the filter textbox when no filter has been entered. */ placeholder: string | undefined; @@ -11408,7 +11408,18 @@ declare module 'vscode' { value: string; /** - * Optional placeholder in the filter text. + * 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; + + /** + * Optional placeholder shown when no value has been input. */ placeholder: string | undefined;