Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use the eval_cache hack to allow traversing of REPL results #764

Merged
merged 1 commit into from
Apr 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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