Skip to content

showQuickPick

The showQuickPick action presents a selection list to the user through the host IDE’s native quick-pick / popup-list UI. It supports single-select and multi-select modes, accepts items as plain strings or structured QuickPickItem objects, and returns the user’s selection (or null on cancellation).

import { showQuickPick } from '@unextension/bridge'

Displays a quick-pick dialog and returns the user’s selection.

const result = await showQuickPick(['TypeScript', 'JavaScript', 'Rust'])
console.log(result.selected) // { label: 'TypeScript', value: 'TypeScript' }
ParameterTypeDescription
itemsstring[] | QuickPickItem[]The items to display in the quick-pick
optionsQuickPickOptionsOptional configuration for the dialog

When items is a string[], each string is automatically converted to a QuickPickItem with both label and value set to the string.

FieldTypeRequiredDescription
labelstringYesDisplayed text for the item
descriptionstringNoSecondary text shown beside the label
detailstringNoAdditional detail shown below the label
valuestringNoReturn value for the item (defaults to label)
OptionTypeDescription
placeholderstringPlaceholder text in the filter input
titlestringTitle shown above the list
canPickManybooleanEnables multi-select mode (default: false)

Promise<QuickPickResult>

FieldTypeDescription
selectedQuickPickItem | QuickPickItem[] | nullThe chosen item(s), or null if cancelled

In single-select mode, selected is a single QuickPickItem or null. In multi-select mode (canPickMany: true), selected is a QuickPickItem[] or null.


const result = await showQuickPick(['Option A', 'Option B', 'Option C'])
if (result.selected) {
console.log('Chosen:', result.selected.label)
}
const result = await showQuickPick(
[
{ label: 'TypeScript', description: 'Typed JavaScript', value: 'ts' },
{ label: 'JavaScript', description: 'Dynamic language', value: 'js' },
{ label: 'Rust', description: 'Systems language', value: 'rs' },
],
{ title: 'Pick a language', placeholder: 'Search languages...' },
)
if (result.selected) {
console.log('Value:', result.selected.value) // 'ts', 'js', or 'rs'
}
const result = await showQuickPick(
[
{ label: 'ESLint', value: 'eslint' },
{ label: 'Prettier', value: 'prettier' },
{ label: 'TypeScript', value: 'typescript' },
],
{ title: 'Select tools to install', canPickMany: true },
)
if (result.selected) {
// selected is QuickPickItem[] in multi-select mode
const tools = result.selected.map((item) => item.value)
console.log('Installing:', tools)
}
const result = await showQuickPick(['Yes', 'No'])
if (result.selected === null) {
console.log('User cancelled the dialog')
return
}
console.log('User chose:', result.selected.label)

showQuickPick resolves with { selected: null } when the user dismisses the dialog. It does not reject the promise on cancellation.

ScenarioResult
User selects an item{ selected: QuickPickItem }
User selects multiple items{ selected: QuickPickItem[] }
User cancels / dismisses dialog{ selected: null }
Empty items arrayShows empty list, cancel → null

All types are exported from @unextension/bridge:

import type { QuickPickItem, QuickPickOptions, QuickPickResult } from '@unextension/bridge'
interface QuickPickItem {
label: string
description?: string
detail?: string
value?: string
}
interface QuickPickOptions {
placeholder?: string
title?: string
canPickMany?: boolean
}
interface QuickPickResult {
selected: QuickPickItem | QuickPickItem[] | null
}