Skip to content

Commit

Permalink
show total files
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Nov 2, 2023
1 parent 2c7f60f commit b76838a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/language-server/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,18 @@ export function startLanguageServer(connection: vscode.Connection, ...plugins: L
const path = URI.parse(asset).path;
if (!fsProgress) {
fsProgress = connection.window.createWorkDoneProgress();
fsProgress.then(progress => progress.begin('Load', 0, path));
fsProgress.then(progress => progress.begin(''));
}
const _fsProgress = await fsProgress;
totalJobs++;
let job!: Promise<T>;
try {
job = fn();
jobs.set(job, path);
for (const [_, path] of jobs) {
_fsProgress.report((totalJobs - jobs.size) / totalJobs * 100, `Loading ${totalJobs - jobs.size} of ${totalJobs} files: ${path}`);
break;
}
return await job;
} finally {
jobs.delete(job);
Expand All @@ -131,7 +135,7 @@ export function startLanguageServer(connection: vscode.Connection, ...plugins: L
}
else {
for (const [_, path] of jobs) {
_fsProgress.report((totalJobs - jobs.size) / totalJobs * 100, path);
_fsProgress.report((totalJobs - jobs.size) / totalJobs * 100, `Loading ${totalJobs - jobs.size} of ${totalJobs} files: ${path}`);
break;
}
}
Expand Down

0 comments on commit b76838a

Please sign in to comment.