MCPcopy Index your code
hub / github.com/microsoft/vscode-js-debug / OutputVariable

Class OutputVariable

src/adapter/variableStore.ts:776–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

774}
775
776class OutputVariable extends Variable {
777 constructor(
778 context: VariableContext,
779 private readonly value: string,
780 private readonly args: ReadonlyArray<Cdp.Runtime.RemoteObject>,
781 private readonly stackTrace: StackTrace | undefined,
782 ) {
783 super(context, { type: args[0]?.type ?? 'string' });
784 }
785
786 public override toDap(): Promise<Dap.Variable> {
787 return Promise.resolve({
788 name: this.context.name,
789 value: this.value,
790 variablesReference: this.stackTrace || this.args.some(objectPreview.previewAsObject)
791 ? this.id
792 : 0,
793 });
794 }
795
796 public override getChildren(_params: Dap.VariablesParams): Promise<Variable[]> {
797 const vars: Variable[] = [];
798 const { args, stackTrace } = this;
799 for (let i = 0; i < args.length; ++i) {
800 if (objectPreview.previewAsObject(args[i])) {
801 vars.push(this.context.createVariableByType({ name: `arg${i}`, sortOrder: i }, args[i]));
802 }
803 }
804
805 if (stackTrace) {
806 vars.push(
807 this.context.createVariable(
808 StacktraceOutputVariable,
809 { name: '', sortOrder: Number.MAX_SAFE_INTEGER },
810 this.remoteObject,
811 stackTrace,
812 ),
813 );
814 }
815
816 return Promise.resolve(vars);
817 }
818}
819
820class StacktraceOutputVariable extends Variable {
821 constructor(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected