From a3ef0268c0bbac4c4aeffd2359766a8b71b9f521 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Sun, 10 Apr 2022 15:49:17 +0200 Subject: [PATCH] Use the eval_cache hack to allow traversing of REPL results (#764) --- src/phpDebug.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/phpDebug.ts b/src/phpDebug.ts index 223e50a9..2eb1ca82 100644 --- a/src/phpDebug.ts +++ b/src/phpDebug.ts @@ -15,6 +15,7 @@ import { BreakpointManager, BreakpointAdapter } from './breakpoints' import * as semver from 'semver' import { LogPointManager } from './logpoint' import { ProxyConnect } from './proxyConnect' +import { randomUUID } from 'crypto' if (process.env['VSCODE_NLS_CONFIG']) { try { @@ -1214,6 +1215,14 @@ class PhpDebugSession extends vscode.DebugSession { if (response.property) { result = response.property } + } else if (args.context === 'repl') { + const uuid = randomUUID() + await connection.sendEvalCommand(`$GLOBALS['eval_cache']['${uuid}']=${args.expression}`) + const ctx = await stackFrame.getContexts() // TODO CACHE THIS + const response = await connection.sendPropertyGetNameCommand(`$eval_cache['${uuid}']`, ctx[1]) + if (response.property) { + result = response.property + } } else { const response = await connection.sendEvalCommand(args.expression) if (response.result) {