How to use the vscode-debugadapter.Variable function in vscode-debugadapter

To help you get started, we’ve selected a few vscode-debugadapter examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github felixfbecker / vscode-php-debug / src / phpDebug.ts View on Github external
const displayValue = formatPropertyValue(property);
                        let variablesReference: number;
                        if (property.hasChildren || property.type === 'array' || property.type === 'object') {
                            // if the property has children, we have to send a variableReference back to VS Code
                            // so it can receive the child elements in another request.
                            // for arrays and objects we do it even when it does not have children so the user can still expand/collapse the entry
                            variablesReference = this._variableIdCounter++;
                            if (property instanceof xdebug.Property) {
                                this._properties.set(variablesReference, property);
                            } else if (property instanceof xdebug.EvalResultProperty) {
                                this._evalResultProperties.set(variablesReference, property);
                            }
                        } else {
                            variablesReference = 0;
                        }
                        return new vscode.Variable(property.name, displayValue, variablesReference);
                    })
                }
github bazelbuild / vscode-bazel / src / debug-adapter / client.ts View on Github external
threadId = 0;
    }

    const variables = new Array();
    for (const value of bazelValues) {
      let valueHandle: number;
      if (value.hasChildren && value.id) {
        // Record the value in a handle so that its children can be queried when
        // the user expands it in the UI. We also record the thread ID for the
        // value since we need it when we make that request later.
        valueHandle = this.variableHandles.create(value);
        this.valueThreadIds.set(valueHandle, threadId);
      } else {
        valueHandle = 0;
      }
      const variable = new Variable(
        value.label,
        value.description,
        valueHandle,
      );
      variables.push(variable);
    }

    response.body = { variables };
    this.sendResponse(response);
  }
github APerricone / harbourCodeExtension / client / src / debugger.js View on Github external
if(line.startsWith("END"))
		{
			this.varResp[id].body = {
				variables: vars
			};
			this.sendResponse(this.varResp[id]);
			this.processLine = undefined;
			return;
		}
		var infos = line.split(":");
		line = infos[0]+":"+infos[1]+":"+infos[2]+":"+infos[3];
		if(infos.length>7)
		{ //the value can contains : , we need to rejoin it.
			infos[6] = infos.splice(6).join(":");
		}
		var v = new debugadapter.Variable(infos[4],infos[6],line);
		v = this.getVariableFormat(v,infos[5],infos[6],"value",line,id);
		vars.push(v);		
	}
}
github hackwaly / vscode-ocaml / src / debug / debug.ts View on Github external
let createVariable = (name: string, value: any): Variable => {
            let text = repr(value);
            let numIndexed;
            let numNamed;

            switch (value.kind) {
                case 'plain':
                    return new Variable(name, text);
                case 'con':
                    numNamed = 0;
                    numIndexed = 1;
                    break;
                case 'record':
                case 'tuple':
                    numNamed = value.items.length;
                    numIndexed = 0;
                    break;
                case 'list':
                case 'array':
                    numIndexed = value.items.length;
                    numNamed = 0;
                    break;
            }
github hackwaly / vscode-ocaml / src / debug / debug.ts View on Github external
numNamed = 0;
                    numIndexed = 1;
                    break;
                case 'record':
                case 'tuple':
                    numNamed = value.items.length;
                    numIndexed = 0;
                    break;
                case 'list':
                case 'array':
                    numIndexed = value.items.length;
                    numNamed = 0;
                    break;
            }

            return new Variable(name, text,
                this._variableHandles.create(new Expander(expander(value))),
                numIndexed, numNamed
            );
        };
github krotik / ecal / ecal-support / src / ecalDebugAdapter.ts View on Github external
vs = this.frameVariableScopes[frameId];
    } else if (scopeType === "global") {
      vs = this.frameVariableGlobalScopes[frameId];
    }

    if (vs) {
      for (const [name, val] of Object.entries(vs)) {
        let valString: string;

        try {
          valString = JSON.stringify(val);
        } catch (e) {
          valString = String(val);
        }

        variables.push(new Variable(name, valString));
      }
    }

    response.body = {
      variables,
    };
    this.sendResponse(response);
  }