(
title: string,
placeholder: string,
cancelToken?: vscode.CancellationToken
)
| 130 | } |
| 131 | |
| 132 | async function showConfirmationPicker( |
| 133 | title: string, |
| 134 | placeholder: string, |
| 135 | cancelToken?: vscode.CancellationToken |
| 136 | ): Promise<string | undefined> { |
| 137 | return new Promise((resolve, reject) => { |
| 138 | const quickPick: vscode.QuickPick<ConfirmationItem> = vscode.window.createQuickPick<ConfirmationItem>(); |
| 139 | quickPick.canSelectMany = false; |
| 140 | quickPick.items = [new ConfirmationItem(localize('continue', 'Continue'), 'yes'), new ConfirmationItem(localize('cancel', 'Cancel'), 'no')]; |
| 141 | quickPick.title = title; |
| 142 | quickPick.placeholder = placeholder; |
| 143 | |
| 144 | let isAccepted: boolean = false; |
| 145 | |
| 146 | quickPick.onDidAccept(async () => { |
| 147 | isAccepted = true; |
| 148 | const value: string = quickPick.selectedItems[0].value; |
| 149 | quickPick.dispose(); |
| 150 | resolve(value); |
| 151 | }); |
| 152 | |
| 153 | quickPick.onDidHide(() => { |
| 154 | if (!isAccepted) { |
| 155 | resolve(undefined); |
| 156 | } |
| 157 | }); |
| 158 | |
| 159 | quickPick.show(); |
| 160 | |
| 161 | if (cancelToken) { |
| 162 | cancelToken.onCancellationRequested(() => { |
| 163 | quickPick.hide(); |
| 164 | reject(new CanceledError()); |
| 165 | }); |
| 166 | } |
| 167 | }); |
| 168 | } |
| 169 | |
| 170 | export interface ITerminalCommandWithLoginArgs { |
| 171 | systemInteractor: ISystemInteractor; |
no test coverage detected