(cb: (token?: vscode.CancellationToken, progress?: vscode.Progress<{ message?: string; increment?: number }>) => T | Promise<T>, location: (string | vscode.ProgressLocation) = vscode.ProgressLocation.Window, title?: string, cancellable?: boolean)
| 297 | // synchronous callbacks are converted to async to properly render the progress bar |
| 298 | // default location is in the help pages tree view |
| 299 | export async function doWithProgress<T>(cb: (token?: vscode.CancellationToken, progress?: vscode.Progress<{ message?: string; increment?: number }>) => T | Promise<T>, location: (string | vscode.ProgressLocation) = vscode.ProgressLocation.Window, title?: string, cancellable?: boolean): Promise<T> { |
| 300 | const location2 = (typeof location === 'string' ? { viewId: location } : location); |
| 301 | const options: vscode.ProgressOptions = { |
| 302 | location: location2, |
| 303 | cancellable: cancellable ?? false, |
| 304 | title: title |
| 305 | }; |
| 306 | return await vscode.window.withProgress(options, async (progress, token) => { |
| 307 | return await new Promise<T>((resolve) => setTimeout(() => { |
| 308 | const ret = cb(token, progress); |
| 309 | resolve(ret); |
| 310 | })); |
| 311 | }); |
| 312 | } |
| 313 | |
| 314 | // get the URL of a CRAN website |
| 315 | // argument path is optional and should be relative to the cran root |
no outgoing calls
no test coverage detected