1 | import { Event } from './event';
|
2 | import { KeySequence } from './keys';
|
3 | import { CancellationToken } from './cancellation';
|
4 | export declare const quickPickServicePath = "/services/quickPick";
|
5 | export declare const QuickPickService: unique symbol;
|
6 | export interface QuickPickService {
|
7 | show<T extends QuickPickItem>(items: Array<T | QuickPickSeparator>, options?: QuickPickOptions<T>): Promise<T | undefined>;
|
8 | setItems<T extends QuickPickItem>(items: Array<T>): void;
|
9 | hide(): void;
|
10 | readonly onDidHide: Event<void>;
|
11 | readonly onDidAccept: Event<void>;
|
12 | readonly onDidChangeValue: Event<{
|
13 | quickPick: QuickPick<QuickPickItem>;
|
14 | filter: string;
|
15 | }>;
|
16 | readonly onDidChangeActive: Event<{
|
17 | quickPick: QuickPick<QuickPickItem>;
|
18 | activeItems: Array<QuickPickItem>;
|
19 | }>;
|
20 | readonly onDidChangeSelection: Event<{
|
21 | quickPick: QuickPick<QuickPickItem>;
|
22 | selectedItems: Array<QuickPickItem>;
|
23 | }>;
|
24 | readonly onDidTriggerButton: Event<QuickInputButtonHandle>;
|
25 | }
|
26 | export interface Match {
|
27 | start: number;
|
28 | end: number;
|
29 | }
|
30 | export interface QuickPickItemHighlights {
|
31 | label?: Match[];
|
32 | description?: Match[];
|
33 | detail?: Match[];
|
34 | }
|
35 | export interface QuickPickItem {
|
36 | type?: 'item';
|
37 | id?: string;
|
38 | label: string;
|
39 | meta?: string;
|
40 | ariaLabel?: string;
|
41 | description?: string;
|
42 | detail?: string;
|
43 | keySequence?: KeySequence;
|
44 | iconClasses?: string[];
|
45 | alwaysShow?: boolean;
|
46 | highlights?: QuickPickItemHighlights;
|
47 | buttons?: QuickInputButton[];
|
48 | execute?: () => void;
|
49 | }
|
50 | export interface QuickPickSeparator {
|
51 | type: 'separator';
|
52 | label?: string;
|
53 | }
|
54 | export type QuickPickItemOrSeparator = QuickPickItem | QuickPickSeparator;
|
55 | export type QuickPickInput<T = QuickPickItem> = T | QuickPickSeparator;
|
56 | export declare namespace QuickPickItem {
|
57 | function is(item: QuickPickSeparator | QuickPickItem): item is QuickPickItem;
|
58 | }
|
59 | export interface QuickPickSeparator {
|
60 | type: 'separator';
|
61 | label?: string;
|
62 | }
|
63 | export declare namespace QuickPickSeparator {
|
64 | function is(item: QuickPickItemOrSeparator): item is QuickPickSeparator;
|
65 | }
|
66 | export type QuickPicks = (QuickPickSeparator | QuickPickItem)[];
|
67 | export interface QuickPickValue<V> extends QuickPickItem {
|
68 | value: V;
|
69 | }
|
70 | export interface QuickInputButton {
|
71 | iconClass?: string;
|
72 | tooltip?: string;
|
73 | |
74 |
|
75 |
|
76 | alwaysVisible?: boolean;
|
77 | }
|
78 | export interface QuickInputButtonHandle extends QuickInputButton {
|
79 | handle: number;
|
80 | }
|
81 | export declare enum QuickInputHideReason {
|
82 | |
83 |
|
84 |
|
85 | Blur = 1,
|
86 | |
87 |
|
88 |
|
89 | Gesture = 2,
|
90 | |
91 |
|
92 |
|
93 | Other = 3
|
94 | }
|
95 | export interface QuickInput {
|
96 | readonly onDidHide: Event<{
|
97 | reason: QuickInputHideReason;
|
98 | }>;
|
99 | readonly onDispose: Event<void>;
|
100 | title: string | undefined;
|
101 | description: string | undefined;
|
102 | step: number | undefined;
|
103 | totalSteps: number | undefined;
|
104 | enabled: boolean;
|
105 | contextKey: string | undefined;
|
106 | busy: boolean;
|
107 | ignoreFocusOut: boolean;
|
108 | show(): void;
|
109 | hide(): void;
|
110 | dispose(): void;
|
111 | }
|
112 | export interface InputBox extends QuickInput {
|
113 | value: string | undefined;
|
114 | valueSelection: Readonly<[number, number]> | undefined;
|
115 | placeholder: string | undefined;
|
116 | password: boolean;
|
117 | readonly onDidChangeValue: Event<string>;
|
118 | readonly onDidAccept: Event<void>;
|
119 | buttons: ReadonlyArray<QuickInputButton>;
|
120 | readonly onDidTriggerButton: Event<QuickInputButton>;
|
121 | prompt: string | undefined;
|
122 | validationMessage: string | undefined;
|
123 | }
|
124 | export interface QuickPick<T extends QuickPickItemOrSeparator> extends QuickInput {
|
125 | value: string;
|
126 | placeholder: string | undefined;
|
127 | items: ReadonlyArray<T | QuickPickSeparator>;
|
128 | activeItems: ReadonlyArray<T>;
|
129 | selectedItems: ReadonlyArray<T>;
|
130 | canSelectMany: boolean;
|
131 | matchOnDescription: boolean;
|
132 | matchOnDetail: boolean;
|
133 | keepScrollPosition: boolean;
|
134 | buttons: ReadonlyArray<QuickInputButton>;
|
135 | readonly onDidAccept: Event<{
|
136 | inBackground: boolean;
|
137 | } | undefined>;
|
138 | readonly onDidChangeValue: Event<string>;
|
139 | readonly onDidTriggerButton: Event<QuickInputButton>;
|
140 | readonly onDidTriggerItemButton: Event<QuickPickItemButtonEvent<QuickPickItem>>;
|
141 | readonly onDidChangeActive: Event<T[]>;
|
142 | readonly onDidChangeSelection: Event<T[]>;
|
143 | }
|
144 | export interface PickOptions<T extends QuickPickItem> {
|
145 | title?: string;
|
146 | placeHolder?: string;
|
147 | matchOnDescription?: boolean;
|
148 | matchOnDetail?: boolean;
|
149 | matchOnLabel?: boolean;
|
150 | autoFocusOnList?: boolean;
|
151 | ignoreFocusLost?: boolean;
|
152 | canPickMany?: boolean;
|
153 | contextKey?: string;
|
154 | activeItem?: Promise<T> | T;
|
155 | onDidFocus?: (entry: T) => void;
|
156 | }
|
157 | export interface InputOptions {
|
158 | title?: string;
|
159 | value?: string;
|
160 | valueSelection?: [number, number];
|
161 | prompt?: string;
|
162 | placeHolder?: string;
|
163 | password?: boolean;
|
164 | ignoreFocusLost?: boolean;
|
165 | validateInput?(input: string): Promise<string | {
|
166 | content: string;
|
167 | severity: number;
|
168 | } | null | undefined> | undefined;
|
169 | }
|
170 | export interface QuickPickItemButtonEvent<T extends QuickPickItemOrSeparator> {
|
171 | button: QuickInputButton;
|
172 | item: T;
|
173 | }
|
174 | export interface QuickPickItemButtonContext<T extends QuickPickItemOrSeparator> extends QuickPickItemButtonEvent<T> {
|
175 | removeItem(): void;
|
176 | }
|
177 | export interface QuickPickOptions<T extends QuickPickItemOrSeparator> {
|
178 | busy?: boolean;
|
179 | enabled?: boolean;
|
180 | title?: string;
|
181 | description?: string;
|
182 | value?: string;
|
183 | filterValue?: (value: string) => string;
|
184 | ariaLabel?: string;
|
185 | buttons?: Array<QuickInputButton>;
|
186 | placeholder?: string;
|
187 | canAcceptInBackground?: boolean;
|
188 | customButton?: boolean;
|
189 | customLabel?: string;
|
190 | customHover?: string;
|
191 | canSelectMany?: boolean;
|
192 | matchOnDescription?: boolean;
|
193 | matchOnDetail?: boolean;
|
194 | matchOnLabel?: boolean;
|
195 | sortByLabel?: boolean;
|
196 | keepScrollPosition?: boolean;
|
197 | autoFocusOnList?: boolean;
|
198 | ignoreFocusOut?: boolean;
|
199 | valueSelection?: Readonly<[number, number]>;
|
200 | validationMessage?: string;
|
201 | hideInput?: boolean;
|
202 | hideCheckAll?: boolean;
|
203 | runIfSingle?: boolean;
|
204 | contextKey?: string;
|
205 | activeItem?: T;
|
206 | step?: number;
|
207 | totalSteps?: number;
|
208 | onDidAccept?: () => void;
|
209 | onDidChangeActive?: (quickPick: QuickPick<T>, activeItems: Array<T>) => void;
|
210 | onDidChangeSelection?: (quickPick: QuickPick<T>, selectedItems: Array<T>) => void;
|
211 | onDidChangeValue?: (quickPick: QuickPick<T>, filter: string) => void;
|
212 | onDidCustom?: () => void;
|
213 | onDidHide?: () => void;
|
214 | onDidTriggerButton?: (button: QuickInputButton) => void;
|
215 | onDidTriggerItemButton?: (ItemButtonEvent: QuickPickItemButtonContext<T>) => void;
|
216 | }
|
217 | export declare const quickInputServicePath = "/services/quickInput";
|
218 | export declare const QuickInputService: unique symbol;
|
219 | export interface QuickInputService {
|
220 | readonly backButton: QuickInputButton;
|
221 | readonly onShow: Event<void>;
|
222 | readonly onHide: Event<void>;
|
223 | open(filter: string): void;
|
224 | createInputBox(): InputBox;
|
225 | input(options?: InputOptions, token?: CancellationToken): Promise<string | undefined>;
|
226 | pick<T extends QuickPickItem>(picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: PickOptions<T> & {
|
227 | canPickMany: true;
|
228 | }, token?: CancellationToken): Promise<T[] | undefined>;
|
229 | pick<T extends QuickPickItem>(picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: PickOptions<T> & {
|
230 | canPickMany: false;
|
231 | }, token?: CancellationToken): Promise<T | undefined>;
|
232 | pick<T extends QuickPickItem>(picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: Omit<PickOptions<T>, 'canPickMany'>, token?: CancellationToken): Promise<T | undefined>;
|
233 | showQuickPick<T extends QuickPickItem>(items: Array<T | QuickPickSeparator>, options?: QuickPickOptions<T>): Promise<T | undefined>;
|
234 | hide(): void;
|
235 | |
236 |
|
237 |
|
238 | createQuickPick<T extends QuickPickItem>(): QuickPick<T>;
|
239 | }
|
240 |
|
241 |
|
242 |
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 | export declare function filterItems(items: QuickPickItemOrSeparator[], filter: string): QuickPickItemOrSeparator[];
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 | export declare function findMatches(word: string, pattern: string): Array<{
|
259 | start: number;
|
260 | end: number;
|
261 | }> | undefined;
|
262 |
|
\ | No newline at end of file |