(
rootVariable: Dap.Variable,
options: ILogOptions = {},
baseIndent: string = '',
)
| 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) { |
no test coverage detected