Skip to content

Commit

Permalink
feat: use the eval_cache hack to allow traversing of REPL results (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
zobo committed Apr 11, 2022
1 parent 89d7eb2 commit 8f70337
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/phpDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8f70337

Please sign in to comment.