Skip to content

Commit 8f70337

Browse files
committed
feat: use the eval_cache hack to allow traversing of REPL results (#764)
1 parent 89d7eb2 commit 8f70337

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/phpDebug.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { BreakpointManager, BreakpointAdapter } from './breakpoints'
1515
import * as semver from 'semver'
1616
import { LogPointManager } from './logpoint'
1717
import { ProxyConnect } from './proxyConnect'
18+
import { randomUUID } from 'crypto'
1819

1920
if (process.env['VSCODE_NLS_CONFIG']) {
2021
try {
@@ -1214,6 +1215,14 @@ class PhpDebugSession extends vscode.DebugSession {
12141215
if (response.property) {
12151216
result = response.property
12161217
}
1218+
} else if (args.context === 'repl') {
1219+
const uuid = randomUUID()
1220+
await connection.sendEvalCommand(`$GLOBALS['eval_cache']['${uuid}']=${args.expression}`)
1221+
const ctx = await stackFrame.getContexts() // TODO CACHE THIS
1222+
const response = await connection.sendPropertyGetNameCommand(`$eval_cache['${uuid}']`, ctx[1])
1223+
if (response.property) {
1224+
result = response.property
1225+
}
12171226
} else {
12181227
const response = await connection.sendEvalCommand(args.expression)
12191228
if (response.result) {

0 commit comments

Comments
 (0)