MCPcopy Index your code
hub / github.com/microsoft/vscode-js-debug / _scopeVariable

Method _scopeVariable

src/adapter/stackTrace.ts:632–666  ·  view source on GitHub ↗

Gets the variable container for a scope. Returns undefined if the thread is not longer paused.

(scopeNumber: number, scope: IScope)

Source from the content-addressed store, hash-verified

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 [];

Callers 2

scopesMethod · 0.95
StackFrameClass · 0.95

Calls 3

pausedVariablesMethod · 0.80
createScopeMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected