(session: vscode.DebugSession, restarTimer = false)
| 442 | } |
| 443 | |
| 444 | public refresh(session: vscode.DebugSession, restarTimer = false): void { |
| 445 | if (session && this.isSameSession(session)) { |
| 446 | const restart = (elapsed: number) => { |
| 447 | if (!this.isStopped && restarTimer && LiveWatchTreeProvider.session) { |
| 448 | this.startTimer(((elapsed < 0) || (elapsed > this.timeoutMs)) ? 0 : elapsed); |
| 449 | } |
| 450 | }; |
| 451 | if (this.variables.getChildren().length === 0) { |
| 452 | restart(0); |
| 453 | } else { |
| 454 | const start = Date.now(); |
| 455 | // The following will update all the variables in the backend cache in bulk |
| 456 | session.customRequest('liveCacheRefresh', { |
| 457 | deleteAll: false // Delete gdb-vars? |
| 458 | }).then(() => { |
| 459 | this.variables.refresh(session).finally(() => { |
| 460 | const elapsed = Date.now() - start; |
| 461 | // console.log(`Refreshed in ${elapsed} ms`); |
| 462 | this.fire(); |
| 463 | if (elapsed > this.timeoutMs) { |
| 464 | console.error('??????? over flow ????'); |
| 465 | } |
| 466 | restart(elapsed); |
| 467 | }); |
| 468 | }); |
| 469 | } |
| 470 | } else { |
| 471 | this.fire(); |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | public getTreeItem(element: LiveVariableNode): TreeItem | Promise<TreeItem> { |
| 476 | return element?.getTreeItem(); |
no test coverage detected