MCPcopy
hub / github.com/microsoft/vscode-js-debug / logVariable

Method logVariable

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

Source from the content-addressed store, hash-verified

86 }
87
88 public logVariable(
89 rootVariable: Dap.Variable,
90 options: ILogOptions = {},
91 baseIndent: string = '',
92 ): Promise<void> {
93 return walkVariables(
94 this._dap,
95 rootVariable,
96 (variable, depth) => {
97 if (
98 kOmitProperties.includes(variable.name) || options.omitProperties?.includes(variable.name)
99 ) {
100 return false;
101 }
102
103 const name = variable.name ? `${variable.name}: ` : '';
104 let value = (variable.presentationHint?.lazy ? '(...)' : variable.value) || '';
105 if (value.endsWith('\n')) value = value.substring(0, value.length - 1);
106 const type = variable.type ? `type=${variable.type}` : '';
107 const namedCount = variable.namedVariables ? ` named=${variable.namedVariables}` : '';
108 const indexedCount = variable.indexedVariables
109 ? ` indexed=${variable.indexedVariables}`
110 : '';
111 const indent = baseIndent + ' '.repeat(depth);
112
113 const expanded = variable.variablesReference ? '> ' : '';
114 let suffix = options.logInternalInfo ? `${type}${namedCount}${indexedCount}` : '';
115 if (suffix) suffix = ' // ' + suffix;
116 let line = `${expanded}${name}${value}`;
117 if (line) {
118 if (line.includes('\n')) line = '\n' + line;
119 this.logAsConsole(`${indent}${line}${suffix}`);
120 }
121
122 return depth < (options.depth ?? 1);
123 },
124 undefined,
125 options.format,
126 );
127 }
128
129 async logOutput(params: Dap.OutputEventParams, options?: ILogOptions) {
130 if (params.group) {

Callers 4

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

Calls 2

logAsConsoleMethod · 0.95
walkVariablesFunction · 0.85

Tested by

no test coverage detected