File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 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 {
14891489 response . body = { result : await varExportProperty ( res . property ) , variablesReference : 0 }
14901490 this . sendResponse ( response )
14911491 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+ }
14921512 } else {
14931513 const res = await connection . sendEvalCommand ( args . expression )
14941514 if ( res . result ) {
You can’t perform that action at this time.
0 commit comments