| 115 | } |
| 116 | |
| 117 | export class MultiStepInput<S> implements IMultiStepInput<S> { |
| 118 | private current?: QuickInput; |
| 119 | private steps: InputStep<S>[] = []; |
| 120 | public run(start: InputStep<S>, state: S) { |
| 121 | return this.stepThrough(start, state); |
| 122 | } |
| 123 | |
| 124 | public async showQuickPick<T extends QuickPickItem, P extends IQuickPickParameters<T>>( |
| 125 | options: P |
| 126 | ): Promise<MultiStepInputQuickPicResponseType<T, P>> { |
| 127 | return this.showLazyLoadQuickPick<T, P>(options).selection; |
| 128 | } |
| 129 | |
| 130 | public showLazyLoadQuickPick<T extends QuickPickItem, P extends IQuickPickParameters<T>>({ |
| 131 | title, |
| 132 | step, |
| 133 | totalSteps, |
| 134 | items, |
| 135 | activeItem, |
| 136 | placeholder, |
| 137 | buttons, |
| 138 | shouldResume, |
| 139 | matchOnDescription, |
| 140 | matchOnDetail, |
| 141 | acceptFilterBoxTextAsSelection, |
| 142 | startBusy, |
| 143 | stopBusy, |
| 144 | validate, |
| 145 | onDidTriggerItemButton, |
| 146 | onDidTriggerButton, |
| 147 | supportBackInFirstStep, |
| 148 | onDidChangeItems, |
| 149 | ignoreFocusOut |
| 150 | }: P): { quickPick: QuickPick<T>; selection: Promise<MultiStepInputQuickPicResponseType<T, P>> } { |
| 151 | const disposables: Disposable[] = []; |
| 152 | const deferred = createDeferred<MultiStepInputQuickPicResponseType<T, P>>(); |
| 153 | const input = window.createQuickPick<T>(); |
| 154 | input.title = title; |
| 155 | input.step = step; |
| 156 | input.totalSteps = totalSteps; |
| 157 | input.placeholder = placeholder; |
| 158 | input.ignoreFocusOut = ignoreFocusOut ?? true; |
| 159 | input.items = items; |
| 160 | if (stopBusy) { |
| 161 | input.busy = startBusy ?? false; |
| 162 | stopBusy( |
| 163 | () => { |
| 164 | if (input.enabled) { |
| 165 | input.busy = false; |
| 166 | } |
| 167 | }, |
| 168 | this, |
| 169 | disposables |
| 170 | ); |
| 171 | } |
| 172 | if (onDidChangeItems) { |
| 173 | input.keepScrollPosition = true; |
| 174 | onDidChangeItems( |
nothing calls this directly
no outgoing calls
no test coverage detected