Skip to content

Commit 0af45a8

Browse files
committed
Document utility function
1 parent d626f14 commit 0af45a8

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

integration/vscode/ada/src/helpers.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,31 @@ export async function parallelize<T, Result>(
576576
* such that progress is reported only when a minimum increment is reached,
577577
* e.g. every 1%.
578578
*
579-
* Here's how the function should be used:
580-
*
581-
* TODO
579+
* @example Here's how the function should be used:
580+
* ```ts
581+
* await vscode.window.withProgress(...,
582+
* async (progress, token) => {
583+
* let done: number = 0;
584+
* let lastProgress = 0;
585+
* const total = ...;
582586
*
587+
* for (...) {
588+
* lastProgress = staggerProgress(
589+
* done,
590+
* total,
591+
* lastProgress,
592+
* (increment) => {
593+
* progress.report({
594+
* message: `${done} / ${total}`,
595+
* increment: increment,
596+
* });
597+
* },
598+
* );
599+
* ++done;
600+
* }
601+
* }
602+
* })
603+
* ```
583604
*
584605
* @param done - the number of items processed since the beginning of the work
585606
* @param total - the total number of items to be processed

0 commit comments

Comments
 (0)