MCPcopy
hub / github.com/microsoft/vscode-js-debug / scopes

Method scopes

src/adapter/stackTrace.ts:789–826  ·  view source on GitHub ↗

@inheritdoc

()

Source from the content-addressed store, hash-verified

787
788 /** @inheritdoc */
789 public async scopes(): Promise<Dap.ScopesResult> {
790 const v = this.source.sourceMap.value.settledValue;
791 const callFrameId = this.root.callFrameId();
792 if (!v || !callFrameId) {
793 return EMPTY_SCOPES;
794 }
795
796 const variables = await v.getVariablesInScope?.(callFrameId, this.wasmPosition);
797 if (!variables) {
798 return EMPTY_SCOPES;
799 }
800
801 const paused = this.thread.pausedVariables();
802 if (!paused) {
803 return EMPTY_SCOPES;
804 }
805
806 const scopeRef: IScopeRef = {
807 stackFrame: this.root,
808 callFrameId,
809 scopeNumber: 0, // this is only used for setting variables, which wasm doesn't support
810 };
811
812 return {
813 scopes: await Promise.all(
814 [...groupBy(variables, v => v.scope)].map(([key, vars]) =>
815 paused
816 .createWasmScope(key as WasmScope, vars, scopeRef)
817 .toDap(PreviewContextType.PropertyValue)
818 .then(v => ({
819 name: v.name,
820 variablesReference: v.variablesReference,
821 expensive: key !== WasmScope.Local,
822 }))
823 ),
824 ),
825 };
826 }
827}

Callers

nothing calls this directly

Calls 8

groupByFunction · 0.90
callFrameIdMethod · 0.80
pausedVariablesMethod · 0.80
allMethod · 0.80
mapMethod · 0.80
createWasmScopeMethod · 0.80
getVariablesInScopeMethod · 0.65
toDapMethod · 0.65

Tested by

no test coverage detected