import URI from './uri'; import { Event } from './event'; import { KeySequence } from './keys'; import { CancellationToken } from './cancellation'; import { URI as Uri } from 'vscode-uri'; export declare const quickPickServicePath = "/services/quickPick"; export declare const QuickPickService: unique symbol; export interface QuickPickService { show(items: Array, options?: QuickPickOptions): Promise; setItems(items: Array): void; hide(): void; readonly onDidHide: Event; readonly onDidAccept: Event; readonly onDidChangeValue: Event<{ quickPick: QuickPick; filter: string; }>; readonly onDidChangeActive: Event<{ quickPick: QuickPick; activeItems: Array; }>; readonly onDidChangeSelection: Event<{ quickPick: QuickPick; selectedItems: Array; }>; readonly onDidTriggerButton: Event; } export interface Match { start: number; end: number; } export interface QuickPickItemHighlights { label?: Match[]; description?: Match[]; detail?: Match[]; } export interface QuickPickItem { type?: 'item'; id?: string; label: string; meta?: string; ariaLabel?: string; description?: string; detail?: string; keySequence?: KeySequence; iconClasses?: string[]; alwaysShow?: boolean; highlights?: QuickPickItemHighlights; buttons?: readonly QuickInputButton[]; execute?: () => void; } export interface QuickPickSeparator { type: 'separator'; label?: string; } export declare type QuickPickItemOrSeparator = QuickPickItem | QuickPickSeparator; export declare namespace QuickPickItem { function is(item: QuickPickSeparator | QuickPickItem): item is QuickPickItem; } export interface QuickPickSeparator { type: 'separator'; label?: string; } export declare namespace QuickPickSeparator { function is(item: QuickPickItemOrSeparator): item is QuickPickSeparator; } export declare type QuickPicks = (QuickPickSeparator | QuickPickItem)[]; export interface QuickPickValue extends QuickPickItem { value: V; } export interface QuickInputButton { iconPath?: URI | Uri | { light?: URI | Uri; dark: URI | Uri; } | { id: string; }; iconClass?: string; tooltip?: string; /** * Whether the button should be visible even when the user is not hovering. */ alwaysVisible?: boolean; } export interface NormalizedQuickInputButton extends QuickInputButton { iconPath?: { light?: Uri; dark: Uri; }; } export declare namespace QuickInputButton { function normalize(button: undefined): undefined; function normalize(button: QuickInputButton): NormalizedQuickInputButton; } export interface QuickInputButtonHandle extends QuickInputButton { index: number; } export declare enum QuickInputHideReason { /** * Focus was moved away from the input, but the user may not have explicitly closed it. */ Blur = 1, /** * An explicit close gesture, like striking the Escape key */ Gesture = 2, /** * Any other reason */ Other = 3 } export interface QuickInput { readonly onDidHide: Event<{ reason: QuickInputHideReason; }>; readonly onDispose: Event; title: string | undefined; description: string | undefined; step: number | undefined; totalSteps: number | undefined; enabled: boolean; contextKey: string | undefined; busy: boolean; ignoreFocusOut: boolean; show(): void; hide(): void; dispose(): void; } export interface InputBox extends QuickInput { value: string | undefined; valueSelection: Readonly<[number, number]> | undefined; placeholder: string | undefined; password: boolean; readonly onDidChangeValue: Event; readonly onDidAccept: Event; buttons: ReadonlyArray; readonly onDidTriggerButton: Event; prompt: string | undefined; validationMessage: string | undefined; } export interface QuickPick extends QuickInput { value: string; placeholder: string | undefined; items: ReadonlyArray; activeItems: ReadonlyArray; selectedItems: ReadonlyArray; canSelectMany: boolean; matchOnDescription: boolean; matchOnDetail: boolean; keepScrollPosition: boolean; readonly onDidAccept: Event<{ inBackground: boolean; } | undefined>; readonly onDidChangeValue: Event; readonly onDidTriggerButton: Event; readonly onDidTriggerItemButton: Event>; readonly onDidChangeActive: Event; readonly onDidChangeSelection: Event; } export interface PickOptions { title?: string; placeHolder?: string; matchOnDescription?: boolean; matchOnDetail?: boolean; matchOnLabel?: boolean; autoFocusOnList?: boolean; ignoreFocusLost?: boolean; canPickMany?: boolean; contextKey?: string; activeItem?: Promise | T; onDidFocus?: (entry: T) => void; } export interface InputOptions { title?: string; value?: string; valueSelection?: [number, number]; prompt?: string; placeHolder?: string; password?: boolean; ignoreFocusLost?: boolean; validateInput?(input: string): Promise | undefined; } export interface QuickPickItemButtonEvent { button: QuickInputButton; item: T; } export interface QuickPickItemButtonContext extends QuickPickItemButtonEvent { removeItem(): void; } export interface QuickPickOptions { busy?: boolean; enabled?: boolean; title?: string; description?: string; value?: string; filterValue?: (value: string) => string; ariaLabel?: string; buttons?: Array; placeholder?: string; canAcceptInBackground?: boolean; customButton?: boolean; customLabel?: string; customHover?: string; canSelectMany?: boolean; matchOnDescription?: boolean; matchOnDetail?: boolean; matchOnLabel?: boolean; sortByLabel?: boolean; keepScrollPosition?: boolean; autoFocusOnList?: boolean; ignoreFocusOut?: boolean; valueSelection?: Readonly<[number, number]>; validationMessage?: string; hideInput?: boolean; hideCheckAll?: boolean; runIfSingle?: boolean; contextKey?: string; activeItem?: T; step?: number; totalSteps?: number; onDidAccept?: () => void; onDidChangeActive?: (quickPick: QuickPick, activeItems: Array) => void; onDidChangeSelection?: (quickPick: QuickPick, selectedItems: Array) => void; onDidChangeValue?: (quickPick: QuickPick, filter: string) => void; onDidCustom?: () => void; onDidHide?: () => void; onDidTriggerButton?: (button: QuickInputButton) => void; onDidTriggerItemButton?: (ItemButtonEvent: QuickPickItemButtonContext) => void; } export declare const QuickInputService: unique symbol; export interface QuickInputService { readonly backButton: QuickInputButton; readonly onShow: Event; readonly onHide: Event; open(filter: string): void; createInputBox(): InputBox; input(options?: InputOptions, token?: CancellationToken): Promise; pick>(picks: Promise | T[], options?: O, token?: CancellationToken): Promise<(O extends { canPickMany: true; } ? T[] : T) | undefined>; showQuickPick(items: Array, options?: QuickPickOptions): Promise; hide(): void; /** * Provides raw access to the quick pick controller. */ createQuickPick(): QuickPick; } /** * Filter the list of quick pick items based on the provided filter. * Items are filtered based on if: * - their `label` satisfies the filter using `fuzzy`. * - their `description` satisfies the filter using `fuzzy`. * - their `detail` satisfies the filter using `fuzzy`. * Filtered items are also updated to display proper highlights based on how they were filtered. * @param items the list of quick pick items. * @param filter the filter to search for. * @returns the list of quick pick items that satisfy the filter. */ export declare function filterItems(items: QuickPickItemOrSeparator[], filter: string): QuickPickItemOrSeparator[]; /** * Find match highlights when testing a word against a pattern. * @param word the word to test. * @param pattern the word to match against. * @returns the list of highlights if present. */ export declare function findMatches(word: string, pattern: string): Array<{ start: number; end: number; }> | undefined; //# sourceMappingURL=quick-pick-service.d.ts.map