public async variables()

in src/legacyEdge/edgeDebugAdapter.ts [311:336]


    public async variables(args: DebugProtocol.VariablesArguments): Promise<IVariablesResponseBody> {
        let variablesResponse = await super.variables(args);
        let filteredVariables: DebugProtocol.Variable[] = [];

        for (let variable of variablesResponse.variables) {
            const variableName = variable.name;
            // We want to filter out entries like "[function return value]", since we do not have a way
            // to change "its value". On the other hand, Chrome's debug protocol never returns entries
            // of this kind.
            if (variableName && variableName[0] === '[' && variableName[variableName.length - 1] === ']') {
                continue;
            }

            // Also filter the `arguments` automatic variable to be in line with what Chrome reports.
            // Plus, changing the `callee`, `caller` fields of this `arguments` will yield an error. We
            // don't have a way to handle it right now.
            if (variableName === 'arguments' && variable.value === 'Arguments') {
                continue;
            }

            filteredVariables.push(variable);
        }

        variablesResponse.variables = filteredVariables;
        return variablesResponse;
    }