showQuickPick

Shows a selection list allowing multiple selections.

Parameter

Name Type Description
items Array<QuickPickItem> An array of strings, or a promise that resolves to an array of strings.
options QuickPickOptions Configures the behavior of the selection list.

Returns

Type Description
Promise<QuickPickItem> A promise that resolves to the selected items or undefined.

Example

  1. const pickResult = hx.window.showQuickPick([
  2. {
  3. label: '../',
  4. description: 'Back to the previous directory录',
  5. backPath: 'foo/bar'
  6. }
  7. ], {placeHolder: 'Please select a directory or file'});
  8. pickResult.then(function(result) {
  9. if (!result) {
  10. return;
  11. }
  12. let backPath = result.backPath;
  13. //do something with result
  14. })

QuickPickOptions

Options to configure the behavior of the quick pick UI.

Attribute name Type Description
placeHolder String An optional string to show as placeholder in the input box to guide the user what to pick on.

QuickPickItem

Represents an item that can be selected from a list of items.

Attribute name Type Description
label String A human-readable string which is rendered prominent.
description String A human-readable string which is rendered less prominent in the same line.

If you want to pass additional data, you can add a custom attribute, when the user selects the item, it will return which candidate is selected through a callback.