diff --git a/src/vs/platform/extensions/common/extensionsApiProposals.ts b/src/vs/platform/extensions/common/extensionsApiProposals.ts index e91088de821..b8d13ce3f00 100644 --- a/src/vs/platform/extensions/common/extensionsApiProposals.ts +++ b/src/vs/platform/extensions/common/extensionsApiProposals.ts @@ -394,6 +394,9 @@ const _allApiProposals = { tunnels: { proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.tunnels.d.ts', }, + valueSelectionInQuickPick: { + proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.valueSelectionInQuickPick.d.ts', + }, workspaceTrust: { proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.workspaceTrust.d.ts', } diff --git a/src/vs/workbench/api/common/extHostQuickOpen.ts b/src/vs/workbench/api/common/extHostQuickOpen.ts index a5194dce8ef..cb17214f2a4 100644 --- a/src/vs/workbench/api/common/extHostQuickOpen.ts +++ b/src/vs/workbench/api/common/extHostQuickOpen.ts @@ -283,6 +283,7 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx private _busy = false; private _ignoreFocusOut = true; private _value = ''; + private _valueSelection: readonly [number, number] | undefined = undefined; private _placeholder: string | undefined; private _buttons: QuickInputButton[] = []; private _handlesToButtons = new Map(); @@ -367,6 +368,15 @@ export function createExtHostQuickOpen(mainContext: IMainContext, workspace: IEx this.update({ value }); } + get valueSelection() { + return this._valueSelection; + } + + set valueSelection(valueSelection: readonly [number, number] | undefined) { + this._valueSelection = valueSelection; + this.update({ valueSelection }); + } + get placeholder() { return this._placeholder; } @@ -713,7 +723,6 @@ 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) { @@ -739,15 +748,6 @@ 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.proposed.valueSelectionInQuickPick.d.ts b/src/vscode-dts/vscode.proposed.valueSelectionInQuickPick.d.ts new file mode 100644 index 00000000000..b6a3bf18684 --- /dev/null +++ b/src/vscode-dts/vscode.proposed.valueSelectionInQuickPick.d.ts @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +declare module 'vscode' { + // @CrafterKolyan https://github.com/microsoft/vscode/issues/233274 + + export interface QuickPick { + /** + * 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; + } +}