提交 33dce47d 编写于 作者: C Christof Marti

Documentation (#45589)

上级 54672717
...@@ -86,6 +86,9 @@ export interface IPickOptions { ...@@ -86,6 +86,9 @@ export interface IPickOptions {
*/ */
contextKey?: string; contextKey?: string;
/**
* an optional flag to make this picker multi-select (honoured by extension API)
*/
multiSelect?: boolean; multiSelect?: boolean;
} }
......
...@@ -1554,6 +1554,9 @@ declare module 'vscode' { ...@@ -1554,6 +1554,9 @@ declare module 'vscode' {
*/ */
ignoreFocusOut?: boolean; ignoreFocusOut?: boolean;
/**
* An optional flag to make the picker multi-select, if true the result is an array of picks.
*/
multiSelect?: boolean; multiSelect?: boolean;
/** /**
...@@ -1562,10 +1565,16 @@ declare module 'vscode' { ...@@ -1562,10 +1565,16 @@ declare module 'vscode' {
onDidSelectItem?(item: QuickPickItem | string): any; onDidSelectItem?(item: QuickPickItem | string): any;
} }
/**
* Represents an item that can be selected in a multi-select quick pick UI.
*/
export interface MultiSelectQuickPickItem extends QuickPickItem { export interface MultiSelectQuickPickItem extends QuickPickItem {
selected?: boolean; selected?: boolean;
} }
/**
* Options to configure the behavior of the multi-select quick pick UI. (Marker type.)
*/
export interface MultiSelectQuickPickOptions extends QuickPickOptions { export interface MultiSelectQuickPickOptions extends QuickPickOptions {
multiSelect: true; multiSelect: true;
} }
...@@ -5077,7 +5086,7 @@ declare module 'vscode' { ...@@ -5077,7 +5086,7 @@ declare module 'vscode' {
* @param items An array of strings, or a promise that resolves to an array of strings. * @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 options Configures the behavior of the selection list.
* @param token A token that can be used to signal cancellation. * @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<string[]>, options: MultiSelectQuickPickOptions, token?: CancellationToken): Thenable<string[] | undefined>; export function showQuickPick(items: string[] | Thenable<string[]>, options: MultiSelectQuickPickOptions, token?: CancellationToken): Thenable<string[] | undefined>;
export function showQuickPick(items: string[] | Thenable<string[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<string | undefined>; export function showQuickPick(items: string[] | Thenable<string[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<string | undefined>;
...@@ -5088,7 +5097,7 @@ declare module 'vscode' { ...@@ -5088,7 +5097,7 @@ declare module 'vscode' {
* @param items An array of items, or a promise that resolves to an array of items. * @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 options Configures the behavior of the selection list.
* @param token A token that can be used to signal cancellation. * @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<T extends MultiSelectQuickPickItem>(items: T[] | Thenable<T[]>, options: MultiSelectQuickPickOptions, token?: CancellationToken): Thenable<T[] | undefined>; export function showQuickPick<T extends MultiSelectQuickPickItem>(items: T[] | Thenable<T[]>, options: MultiSelectQuickPickOptions, token?: CancellationToken): Thenable<T[] | undefined>;
export function showQuickPick<T extends QuickPickItem>(items: T[] | Thenable<T[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<T | undefined>; export function showQuickPick<T extends QuickPickItem>(items: T[] | Thenable<T[]>, options?: QuickPickOptions, token?: CancellationToken): Thenable<T | undefined>;
......
...@@ -143,9 +143,11 @@ export class QuickInputService extends Component implements IQuickInputService { ...@@ -143,9 +143,11 @@ export class QuickInputService extends Component implements IQuickInputService {
this.resolve(); this.resolve();
} }
// TODO: Listen on cancellation token.
this.inputBox.setValue(''); this.inputBox.setValue('');
// TODO: Localize shortcut. // 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. // TODO: Progress indication.
this.checkboxList.setElements(await picks); this.checkboxList.setElements(await picks);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册