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

Method getVariables

src/adapter/variableStore.ts:1714–1742  ·  view source on GitHub ↗

Gets variables from a known IVariableContainer

(params: Dap.VariablesParams)

Source from the content-addressed store, hash-verified

1712
1713 /** Gets variables from a known {@link IVariableContainer} */
1714 public async getVariables(params: Dap.VariablesParams): Promise<Dap.Variable[]> {
1715 const container = this.vars.get(params.variablesReference);
1716 if (!container) {
1717 return [];
1718 }
1719
1720 const children = await container.getChildren(params);
1721 const daps = await Promise.all(
1722 children.map(v =>
1723 v
1724 .toDap(
1725 container instanceof Scope || container instanceof OutputVariableContainer
1726 ? PreviewContextType.Repl
1727 : PreviewContextType.PropertyValue,
1728 params.format,
1729 )
1730 .then(dap => ({ v, dap }))
1731 ),
1732 );
1733
1734 return daps
1735 .sort(
1736 (a, b) =>
1737 a.v.sortOrder - b.v.sortOrder
1738 || +a.dap.name - +b.dap.name
1739 || a.dap.name.localeCompare(b.dap.name),
1740 )
1741 .map(v => v.dap);
1742 }
1743
1744 public async getLocations(variablesReference: number): Promise<Cdp.Debugger.Location> {
1745 const locationVar = this.vars.get(variablesReference);

Callers 1

_onVariablesMethod · 0.80

Calls 5

allMethod · 0.80
mapMethod · 0.80
getMethod · 0.65
getChildrenMethod · 0.65
toDapMethod · 0.65

Tested by

no test coverage detected