@@ -1475,7 +1475,7 @@ class PhpDebugSession extends vscode.DebugSession {
14751475 if ( res . property ) {
14761476 result = res . property
14771477 }
1478- } else if ( args . context === 'repl' ) {
1478+ } else if ( args . context === 'repl' || args . context === 'watch' ) {
14791479 const uuid = randomUUID ( )
14801480 await connection . sendEvalCommand ( `$GLOBALS['eval_cache']['${ uuid } ']=${ args . expression } ` )
14811481 const ctx = await stackFrame . getContexts ( ) // TODO CACHE THIS
@@ -1489,30 +1489,6 @@ 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- // 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- }
1515- }
15161492 } else {
15171493 const res = await connection . sendEvalCommand ( args . expression )
15181494 if ( res . result ) {
0 commit comments