Gets the variable container for a scope. Returns undefined if the thread is not longer paused.
(scopeNumber: number, scope: IScope)
| 630 | |
| 631 | /** Gets the variable container for a scope. Returns undefined if the thread is not longer paused. */ |
| 632 | private _scopeVariable(scopeNumber: number, scope: IScope): IVariableContainer | undefined { |
| 633 | const existing = scope.variables[scopeNumber]; |
| 634 | if (existing) { |
| 635 | return existing; |
| 636 | } |
| 637 | |
| 638 | const scopeRef: IScopeRef = { |
| 639 | stackFrame: this, |
| 640 | callFrameId: scope.callFrameId, |
| 641 | scopeNumber, |
| 642 | }; |
| 643 | |
| 644 | const extraProperties: IExtraProperty[] = []; |
| 645 | if (scopeNumber === 0) { |
| 646 | if (scope.thisObject) extraProperties.push({ name: 'this', value: scope.thisObject }); |
| 647 | if (scope.returnValue) { |
| 648 | extraProperties.push({ |
| 649 | name: l10n.t('Return value'), |
| 650 | value: scope.returnValue, |
| 651 | }); |
| 652 | } |
| 653 | } |
| 654 | |
| 655 | const paused = this._thread.pausedVariables(); |
| 656 | if (!paused) { |
| 657 | return undefined; |
| 658 | } |
| 659 | |
| 660 | const variable = paused.createScope( |
| 661 | scope.chain[scopeNumber].object, |
| 662 | scopeRef, |
| 663 | extraProperties, |
| 664 | ); |
| 665 | return (scope.variables[scopeNumber] = variable); |
| 666 | } |
| 667 | |
| 668 | public readonly completions = once(async (): Promise<Dap.CompletionItem[]> => { |
| 669 | if (!this._scope) return []; |
no test coverage detected