#66241

Debugger hover resolves PHP variable declarations but not references

Openkarimis21-codeopened 2d ago

Reproduction steps

Attach debugger to a process and try to hover over variables. I reproduce it on a PHP project, but i guess it is a more generic issue.

Current vs. Expected behavior

current behavior:

https://github.com/user-attachments/assets/607aa5f7-df5c-4406-bde9-e9d5deb3b5b8

expected behavior:

  • hover over $class should always popup the variable value as done in first line.
  • $file = .., hover over $file should show the variable value in general as you see in the video all variables values should be shown when hovered over

Also issue with 'Evaluate Selection' :

current:

https://github.com/user-attachments/assets/9e534ad0-d0fa-438e-b3dd-469f9e74f016

expected:

  • in Console window i would expect the value shown to be expandable like in the hover popup. I tried this to use as fallback for variables that hover does not work as expected, but neither this works as is should.

Debugging will always be crucial for all apps, and right now it is not helping me debug my app...

Zed version and system specs

Zed: v1.26.2+preview.381.87353f5227f6bc0757c3a077f42841dac6a8ed8e (Zed Preview) OS: Windows 10.0.26300 Memory: 31.9 GiB Architecture: x86_64 GPU: NVIDIA GeForce RTX 3060 Ti || NVIDIA Corporation || 621.1 r620_97

project shown is in WSL ubuntu 26.04

Attach Zed log file

No response

Relevant Zed settings

settings.json
undefined

Relevant Keymap

keymap.json
undefined

(for AI issues) Model provider details

No response

If you are using WSL on Windows, what flavor of Linux are you using?

Ubuntu

Activity

2
yeskunall2d ago

I reproduced the hover issue in the existing Nightly app with PHP/Xdebug. While stopped at a breakpoint, the same initialized $class object has a runtime hover on its declaration but not on references before or after the stopped line. Evaluate, Watch, and Locals resolve it.

Minimal reproduction and environment
<?php
function inspect_hover(): void {
    $class = (object) ['name' => 'fixture', 'count' => 42];
    $file = 'fixture.php';
    $before = $class;
    $stop = 1;
    $after = $class;
    echo $file, $class->name, $before->count, $after->count, $stop;
}
inspect_hover();
  1. Launch this script with Xdebug and set a breakpoint on line 6 ($stop = 1;).
  2. While stopped in inspect_hover, hover over $class without modifiers on lines 3, 5, and 7.
  3. Line 3 shows an expandable object; lines 5 and 7 show no popup. Evaluate $class, then add it to Watch and expand it in Locals: both properties are available.

Tested on macOS 15.8.1 arm64, Zed Nightly 1.27.0 build 20261028.024048, commit 37faef81f74fc1bb08be9939c4cffc8ede6ced2f, PHP 8.5.11, Xdebug 3.5.0, PHP extension 0.5.4, and PHP debug adapter 1.40.2. I did not restart the app.

The session’s DAP log showed a successful evaluateResponse for $file with result "fixture.php" and variablesReference: 0. The engine-side DBGp trace confirmed the stop at line 6 and successful $class property/evaluation responses with name = "fixture" and count = 42.

The installed PHP debugger query captures assignment-left variables but not these RHS references, which appears to explain this difference. PHPactor failed to launch in this test, so these are debugger-value observations, not LSP documentation hovers.

I did not test the exact WSL attachment setup or the separate Console expansion behavior. Can @karimis21-code share a small object/array example for “Evaluate Selection”? The $class result shown in the recording is a string, which would not itself have child properties.

karimis21-code1d ago

Hi @yeskunall thank you for looking into this, as ti makes using debugger a bit challening.... In my previous post i include 2 videos. the second is right after text "Also issue with 'Evaluate Selection' :" in that video i show that i highlight the var $includeFile and the hover shows its value as Closure object properties. i then right-click it and select Evaluate Selection and it shows: > $includeFile < Closure with nothing being clickable / expandable.

if the video is not visible please let me know so i will upload another one