Gets variables from a known IVariableContainer
(params: Dap.VariablesParams)
| 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); |
no test coverage detected