| 220 | context?: 'watch' | 'repl' | 'hover' | 'clipboard', |
| 221 | ): Promise<void>; |
| 222 | async evaluateAndLog( |
| 223 | expressions: string[] | string, |
| 224 | options: ILogOptions = {}, |
| 225 | context?: 'watch' | 'repl' | 'hover' | 'clipboard', |
| 226 | ): Promise<Dap.Variable | void> { |
| 227 | if (typeof expressions === 'string') { |
| 228 | const result = await this._dap.evaluate({ |
| 229 | expression: expressions, |
| 230 | context, |
| 231 | ...options.params, |
| 232 | format: options.format, |
| 233 | }); |
| 234 | if (typeof result === 'string') { |
| 235 | this._log(`<error>: ${result}`); |
| 236 | return { name: 'result', value: result, variablesReference: 0 }; |
| 237 | } |
| 238 | return await this.logEvaluateResult(result, options); |
| 239 | } |
| 240 | |
| 241 | for (const expression of expressions) { |
| 242 | this._log(`Evaluating: '${expression}'`); |
| 243 | const evaluation = this._dap.evaluate({ expression, context }); |
| 244 | await this.logOutput(await this._dap.once('output'), options); |
| 245 | await evaluation; |
| 246 | this._log(``); |
| 247 | } |
| 248 | } |
| 249 | } |