MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / updateProgress

Function updateProgress

src/extension/commands/batch_progress.ts:25–44  ·  view source on GitHub ↗
(increment?: boolean)

Source from the content-addressed store, hash-verified

23 let numCompleted = 0;
24
25 function updateProgress(increment?: boolean) {
26 const activePackageNames = [...activePackages.values()];
27 const firstPackageName = activePackageNames[0];
28 const numTotal = uris.length;
29 const numRemaining = numTotal - numCompleted;
30
31 // Instead of using the actual count here (activePackageNames.length - 1), which causes
32 // flickering as one completes and reduces the count before the next starts, just give
33 // an approximate value of the cap of Min(maxConcurrent, remaining) - 1 instead.
34 const otherActiveCount = Math.min(maxConcurrent, numRemaining) - 1;
35 if (firstPackageName) {
36 const statusMessage = otherActiveCount > 0
37 ? `${firstPackageName} (+ ${otherActiveCount} others)...`
38 : firstPackageName;
39 operationProgress.progressReporter.report({
40 message: `${statusMessage} (${numCompleted}/${numTotal} total)`,
41 increment: increment ? 100 / numTotal : undefined,
42 });
43 }
44 }
45
46 updateProgress();
47 await runWithConcurrencyLimit(

Callers 1

runBatchFolderOperationFunction · 0.70

Calls 2

valuesMethod · 0.80
reportMethod · 0.80

Tested by

no test coverage detected