MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / showConfirmationPicker

Function showConfirmationPicker

Extension/src/SSH/sshCommandRunner.ts:132–168  ·  view source on GitHub ↗
(
    title: string,
    placeholder: string,
    cancelToken?: vscode.CancellationToken
)

Source from the content-addressed store, hash-verified

130}
131
132async 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
170export interface ITerminalCommandWithLoginArgs {
171 systemInteractor: ISystemInteractor;

Callers 2

showHostKeyConfirmationFunction · 0.85

Calls 4

hideMethod · 0.80
disposeMethod · 0.65
showMethod · 0.45

Tested by

no test coverage detected