From 1ae9b159e5c463b7f19749237dd6fb37e8be4cd5 Mon Sep 17 00:00:00 2001 From: Damjan Cvetko Date: Wed, 16 Mar 2022 00:28:38 +0100 Subject: [PATCH] Use the eval_cache hack to allow traversing of REPL results --- 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) {