diff --git a/src/vs/platform/quickOpen/common/quickOpen.ts b/src/vs/platform/quickOpen/common/quickOpen.ts index a6a169303b9715bc2169340cc9a02166f0fa2e1b..eef2fa91bd5f718d4789b9b611d2e59746e0febe 100644 --- a/src/vs/platform/quickOpen/common/quickOpen.ts +++ b/src/vs/platform/quickOpen/common/quickOpen.ts @@ -86,6 +86,9 @@ export interface IPickOptions { */ contextKey?: string; + /** + * an optional flag to make this picker multi-select (honoured by extension API) + */ multiSelect?: boolean; } diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 0db6fc8d414c787378f83cb12a5872e4fd8ea75c..2295b78cdc197e4d90e6cf01e26ce8814d55c0a5 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -1554,6 +1554,9 @@ declare module 'vscode' { */ ignoreFocusOut?: boolean; + /** + * An optional flag to make the picker multi-select, if true the result is an array of picks. + */ multiSelect?: boolean; /** @@ -1562,10 +1565,16 @@ declare module 'vscode' { onDidSelectItem?(item: QuickPickItem | string): any; } + /** + * Represents an item that can be selected in a multi-select quick pick UI. + */ export interface MultiSelectQuickPickItem extends QuickPickItem { selected?: boolean; } + /** + * Options to configure the behavior of the multi-select quick pick UI. (Marker type.) + */ export interface MultiSelectQuickPickOptions extends QuickPickOptions { multiSelect: true; } @@ -5077,7 +5086,7 @@ declare module 'vscode' { * @param items An array of strings, or a promise that resolves to an array of strings. * @param options Configures the behavior of the selection list. * @param token A token that can be used to signal cancellation. - * @return A promise that resolves to the selection or `undefined`. + * @return A promise that resolves to the selected item(s) or `undefined`. */ export function showQuickPick(items: string[] | Thenable, options: MultiSelectQuickPickOptions, token?: CancellationToken): Thenable; export function showQuickPick(items: string[] | Thenable, options?: QuickPickOptions, token?: CancellationToken): Thenable; @@ -5088,7 +5097,7 @@ declare module 'vscode' { * @param items An array of items, or a promise that resolves to an array of items. * @param options Configures the behavior of the selection list. * @param token A token that can be used to signal cancellation. - * @return A promise that resolves to the selected item or `undefined`. + * @return A promise that resolves to the selected item(s) or `undefined`. */ export function showQuickPick(items: T[] | Thenable, options: MultiSelectQuickPickOptions, token?: CancellationToken): Thenable; export function showQuickPick(items: T[] | Thenable, options?: QuickPickOptions, token?: CancellationToken): Thenable; diff --git a/src/vs/workbench/browser/parts/quickinput/quickInput.ts b/src/vs/workbench/browser/parts/quickinput/quickInput.ts index 182ca41f98647e8fcb0a4c7aa29171c8bbbd6238..be6f2ff0d33044cc5b5837ea34f464b7d56c460d 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInput.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInput.ts @@ -143,9 +143,11 @@ export class QuickInputService extends Component implements IQuickInputService { this.resolve(); } + // TODO: Listen on cancellation token. + this.inputBox.setValue(''); // TODO: Localize shortcut. - this.inputBox.setPlaceholder(options.placeHolder ? localize('quickInput.ctrlSpaceToSelectWithPlaceholder', "{1} ({0} to toggle)", 'Cmd+Space', options.placeHolder) : localize('quickInput.ctrlSpaceToSelect', "{0} to toggle", 'Cmd+Space')); + this.inputBox.setPlaceholder(options.placeHolder ? localize('quickInput.ctrlSpaceToSelectWithPlaceholder', "{1} ({0} to toggle)", 'Ctrl+Space', options.placeHolder) : localize('quickInput.ctrlSpaceToSelect', "{0} to toggle", 'Ctrl+Space')); // TODO: Progress indication. this.checkboxList.setElements(await picks);