@@ -19,6 +19,7 @@ import { randomUUID } from 'crypto'
1919import { getConfiguredEnvironment } from './envfile'
2020import { XdebugCloudConnection } from './cloud'
2121import { shouldIgnoreException } from './ignore'
22+ import { varExportProperty } from './varExport'
2223
2324if ( process . env [ 'VSCODE_NLS_CONFIG' ] ) {
2425 try {
@@ -1470,34 +1471,28 @@ class PhpDebugSession extends vscode.DebugSession {
14701471 if ( args . context === 'hover' ) {
14711472 // try to get variable from property_get
14721473 const ctx = await stackFrame . getContexts ( ) // TODO CACHE THIS
1473- const response = await connection . sendPropertyGetNameCommand ( args . expression , ctx [ 0 ] )
1474- if ( response . property ) {
1475- result = response . property
1474+ const res = await connection . sendPropertyGetNameCommand ( args . expression , ctx [ 0 ] )
1475+ if ( res . property ) {
1476+ result = res . property
14761477 }
14771478 } else if ( args . context === 'repl' ) {
14781479 const uuid = randomUUID ( )
14791480 await connection . sendEvalCommand ( `$GLOBALS['eval_cache']['${ uuid } ']=${ args . expression } ` )
14801481 const ctx = await stackFrame . getContexts ( ) // TODO CACHE THIS
1481- const response = await connection . sendPropertyGetNameCommand ( `$eval_cache['${ uuid } ']` , ctx [ 1 ] )
1482- if ( response . property ) {
1483- result = response . property
1482+ const res = await connection . sendPropertyGetNameCommand ( `$eval_cache['${ uuid } ']` , ctx [ 1 ] )
1483+ if ( res . property ) {
1484+ result = res . property
14841485 }
14851486 } else if ( args . context === 'clipboard' ) {
1486- const uuid = randomUUID ( )
14871487 const ctx = await stackFrame . getContexts ( ) // TODO CACHE THIS
1488- await connection . sendEvalCommand (
1489- `$GLOBALS['eval_cache']['${ uuid } ']=var_export(${ args . expression } , true)` ,
1490- ctx [ 1 ]
1491- )
1492- const res = await connection . sendPropertyValueNameCommand ( `$eval_cache['${ uuid } ']` , ctx [ 1 ] )
1493- // force a string response
1494- response . body = { result : res . value , variablesReference : 0 }
1488+ const res = await connection . sendPropertyGetNameCommand ( args . expression , ctx [ 0 ] )
1489+ response . body = { result : await varExportProperty ( res . property ) , variablesReference : 0 }
14951490 this . sendResponse ( response )
14961491 return
14971492 } else {
1498- const response = await connection . sendEvalCommand ( args . expression )
1499- if ( response . result ) {
1500- result = response . result
1493+ const res = await connection . sendEvalCommand ( args . expression )
1494+ if ( res . result ) {
1495+ result = res . result
15011496 }
15021497 }
15031498
0 commit comments