MCPcopy Create free account
hub / github.com/Snapchat/Valdi / logVariable

Method logVariable

valdi/vscode_debugger/src/test/logger.ts:80–105  ·  view source on GitHub ↗
(
    rootVariable: Dap.Variable,
    options: ILogOptions = {},
    baseIndent: string = '',
  )

Source from the content-addressed store, hash-verified

78 }
79
80 public logVariable(
81 rootVariable: Dap.Variable,
82 options: ILogOptions = {},
83 baseIndent: string = '',
84 ): Promise<void> {
85 return walkVariables(this._dap, rootVariable, (variable, depth) => {
86 const name = variable.name ? `${variable.name}: ` : '';
87 let value = variable.value || '';
88 if (value.endsWith('\n')) value = value.substring(0, value.length - 1);
89 const type = variable.type ? `type=${variable.type}` : '';
90 const namedCount = variable.namedVariables ? ` named=${variable.namedVariables}` : '';
91 const indexedCount = variable.indexedVariables ? ` indexed=${variable.indexedVariables}` : '';
92 const indent = baseIndent + ' '.repeat(depth);
93
94 const expanded = variable.variablesReference ? '> ' : '';
95 let suffix = options.logInternalInfo ? `${type}${namedCount}${indexedCount}` : '';
96 if (suffix) suffix = ' // ' + suffix;
97 let line = `${expanded}${name}${value}`;
98 if (line) {
99 if (line.includes('\n')) line = '\n' + line;
100 this.logAsConsole(`${indent}${line}${suffix}`);
101 }
102
103 return depth < (options.depth ?? 1);
104 });
105 }
106
107 async logOutput(params: Dap.OutputEventParams, options?: ILogOptions) {
108 if (params.group) {

Callers 4

logOutputMethod · 0.95
logEvaluateResultMethod · 0.95
logStackTraceMethod · 0.95
variablesTest.tsFile · 0.80

Calls 3

logAsConsoleMethod · 0.95
walkVariablesFunction · 0.85
substringMethod · 0.80

Tested by

no test coverage detected