Skip to content

Commit 513fcc8

Browse files
authored
fix: Revert watch property get to eval with eval_cache (#1021)
* Revert watch property get to eval with eval_cache. * Revert watch property get to eval with eval_cache. * Changelog
1 parent 60e057d commit 513fcc8

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [1.36.2]
8+
9+
- Revert watch handling to eval
10+
711
## [1.36.1]
812

913
- Improve handling of watch for static properties

src/phpDebug.ts

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,28 +1490,12 @@ class PhpDebugSession extends vscode.DebugSession {
14901490
this.sendResponse(response)
14911491
return
14921492
} else if (args.context === 'watch') {
1493-
// try to translate static variable to special Xdebug format
1494-
if (args.expression.startsWith('self::$')) {
1495-
args.expression = '$this::' + args.expression.substring(7)
1496-
}
1497-
// if we suspect a function call
1498-
if (!args.expression.startsWith('$') || args.expression.includes('(')) {
1499-
if (stackFrame.level !== 0) {
1500-
throw new Error('Cannot evaluate function calls when not on top of the stack')
1501-
}
1502-
const uuid = randomUUID()
1503-
await connection.sendEvalCommand(`$GLOBALS['eval_cache']['${uuid}']=${args.expression}`)
1504-
const ctx = await stackFrame.getContexts() // TODO CACHE THIS
1505-
const res = await connection.sendPropertyGetNameCommand(`$eval_cache['${uuid}']`, ctx[1])
1506-
if (res.property) {
1507-
result = res.property
1508-
}
1509-
} else {
1510-
const ctx = await stackFrame.getContexts() // TODO CACHE THIS
1511-
const res = await connection.sendPropertyGetNameCommand(args.expression, ctx[0])
1512-
if (res.property) {
1513-
result = res.property
1514-
}
1493+
const uuid = randomUUID()
1494+
await connection.sendEvalCommand(`$GLOBALS['eval_cache']['watch']['${uuid}']=${args.expression}`)
1495+
const ctx = await stackFrame.getContexts() // TODO CACHE THIS
1496+
const res = await connection.sendPropertyGetNameCommand(`$eval_cache['watch']['${uuid}']`, ctx[1])
1497+
if (res.property) {
1498+
result = res.property
15151499
}
15161500
} else {
15171501
const res = await connection.sendEvalCommand(args.expression)

0 commit comments

Comments
 (0)