(
msg: string,
prompt?: string,
cancelToken?: vscode.CancellationToken
)
| 63 | } |
| 64 | |
| 65 | export async function showInputBox( |
| 66 | msg: string, |
| 67 | prompt?: string, |
| 68 | cancelToken?: vscode.CancellationToken |
| 69 | ): Promise<string | undefined> { |
| 70 | return new Promise((resolve, reject) => { |
| 71 | const quickPick: vscode.InputBox = vscode.window.createInputBox(); |
| 72 | quickPick.title = msg; |
| 73 | quickPick.prompt = prompt; |
| 74 | quickPick.password = true; |
| 75 | quickPick.ignoreFocusOut = true; |
| 76 | |
| 77 | let isAccepted: boolean = false; |
| 78 | |
| 79 | quickPick.onDidAccept(() => { |
| 80 | isAccepted = true; |
| 81 | const passphrase: string = quickPick.value; |
| 82 | quickPick.dispose(); |
| 83 | resolve(passphrase); |
| 84 | }); |
| 85 | |
| 86 | quickPick.onDidHide(() => { |
| 87 | if (!isAccepted) { |
| 88 | resolve(undefined); |
| 89 | } |
| 90 | }); |
| 91 | |
| 92 | quickPick.show(); |
| 93 | |
| 94 | if (cancelToken) { |
| 95 | cancelToken.onCancellationRequested(() => { |
| 96 | reject(new CanceledError()); |
| 97 | quickPick.dispose(); |
| 98 | }); |
| 99 | } |
| 100 | }); |
| 101 | } |
| 102 | |
| 103 | class ConfirmationItem implements vscode.QuickPickItem, vscode.MessageItem { |
| 104 | title: string; |
no test coverage detected