File tree 1 file changed +20
-0
lines changed 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1489,6 +1489,26 @@ class PhpDebugSession extends vscode.DebugSession {
1489
1489
response . body = { result : await varExportProperty ( res . property ) , variablesReference : 0 }
1490
1490
this . sendResponse ( response )
1491
1491
return
1492
+ } else if ( args . context === 'watch' ) {
1493
+ // if we suspect a function call
1494
+ if ( args . expression . includes ( '(' ) ) {
1495
+ if ( stackFrame . level !== 0 ) {
1496
+ throw new Error ( 'Cannot evaluate function calls when not on top of the stack' )
1497
+ }
1498
+ const uuid = randomUUID ( )
1499
+ await connection . sendEvalCommand ( `$GLOBALS['eval_cache']['${ uuid } ']=${ args . expression } ` )
1500
+ const ctx = await stackFrame . getContexts ( ) // TODO CACHE THIS
1501
+ const res = await connection . sendPropertyGetNameCommand ( `$eval_cache['${ uuid } ']` , ctx [ 1 ] )
1502
+ if ( res . property ) {
1503
+ result = res . property
1504
+ }
1505
+ } else {
1506
+ const ctx = await stackFrame . getContexts ( ) // TODO CACHE THIS
1507
+ const res = await connection . sendPropertyGetNameCommand ( args . expression , ctx [ 0 ] )
1508
+ if ( res . property ) {
1509
+ result = res . property
1510
+ }
1511
+ }
1492
1512
} else {
1493
1513
const res = await connection . sendEvalCommand ( args . expression )
1494
1514
if ( res . result ) {
You can’t perform that action at this time.
0 commit comments