(
files: string[],
)
| 291 | } |
| 292 | |
| 293 | private async *refreshFiles( |
| 294 | files: string[], |
| 295 | ): AsyncGenerator<IndexingProgressUpdate> { |
| 296 | let progress = 0; |
| 297 | if (files.length === 0) { |
| 298 | yield { |
| 299 | progress: 1, |
| 300 | desc: "Indexing Complete", |
| 301 | status: "done", |
| 302 | }; |
| 303 | } |
| 304 | |
| 305 | const workspaceDirs = await this.ide.getWorkspaceDirs(); |
| 306 | |
| 307 | const progressPer = 1 / files.length; |
| 308 | try { |
| 309 | for (const file of files) { |
| 310 | yield { |
| 311 | progress, |
| 312 | desc: `Indexing file ${file}...`, |
| 313 | status: "indexing", |
| 314 | }; |
| 315 | await this.refreshFile(file, workspaceDirs); |
| 316 | |
| 317 | progress += progressPer; |
| 318 | |
| 319 | if (this.pauseToken.paused) { |
| 320 | yield* this.yieldUpdateAndPause(); |
| 321 | } |
| 322 | } |
| 323 | |
| 324 | yield { |
| 325 | progress: 1, |
| 326 | desc: "Indexing Complete", |
| 327 | status: "done", |
| 328 | }; |
| 329 | } catch (err) { |
| 330 | yield this.handleErrorAndGetProgressUpdate(err); |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | async *refreshDirs( |
| 335 | dirs: string[], |
no test coverage detected