示例#1
0
        public override void Variables(Response response, dynamic arguments)
        {
            int varsHandle = getInt(arguments, "variablesReference");

            SessionLog.WriteLine($"variables request {varsHandle}");
            var variables = _variableHandles.Get(varsHandle, null);

            if (variables == null)
            {
                SendErrorResponse(response, 10001, "No active stackframe");
                return;
            }

            _process.FillVariables(variables);

            var responseArray = new VSCodeDebug.Variable[variables.Count];

            for (int i = 0; i < responseArray.Length; i++)
            {
                var variable = variables[i];

                if (variable.IsStructured && variable.ChildrenHandleID == 0)
                {
                    variable.ChildrenHandleID = _variableHandles.Create(variables.CreateChildLocator(i));
                }

                responseArray[i] = new VSCodeDebug.Variable(
                    variable.Name,
                    variable.Presentation,
                    variable.TypeName,
                    variable.ChildrenHandleID);
            }

            SendResponse(response, new VariablesResponseBody(responseArray));
        }
 public VariablesResponseBody(List<Variable> vars = null)
 {
     if (vars == null)
         variables = new Variable[0];
     else
         variables = vars.ToArray<Variable>();
 }