Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xdebug for VSCode truncates long variables in preview

When I debug variables in VSCode using Xdebug, the long variables (like SQL sentences) are truncated in the preview mouseover or in the inspection panel.

How I can to see the complete text?

like image 649
FelipeR Avatar asked Mar 27 '18 14:03

FelipeR


People also ask

Why is Xdebug not working?

Xdebug cannot connect to PhpStorm This means that Xdebug tries to connect to the host and can't make the connection. To fix the issue, set xdebug. remote_connect_back=0 ( xdebug. discover_client_host=false for Xdebug 3) and make sure that xdebug.

How do I turn off auto debug in VS code?

To end a debugging session in Microsoft Visual Studio, from the Debug menu, choose Stop Debugging.

How do I debug xdebug?

Press F5 to start the debugger. Click the new XDebug Helper extension and click the Debug option. Finally, refresh the page in the browser to let VSCode react and start the debugging process.


1 Answers

I had the same and another problem (hidden children variables and only 32 inner variables were not visible).

Update your launch config (.vscode/launch.json). Set xdebugSettings:

"xdebugSettings": {
    "max_children": 999, // max number of array or object children to initially retrieve.
    "max_depth": 10, // maximum depth that the debugger engine may return when sending arrays, hashs or object structures to the IDE.
    "max_data": 10240 // max length of a string value of an inspected variable. The default value is 1024. So some values can be clipped.
}
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "/app": "${workspaceFolder}"
            },
            "xdebugSettings": {
                "max_children": 999,
                "max_depth": 10,
                "max_data": 10240
            }
        },
]}

Look at all params: https://github.com/xdebug/vscode-php-debug#supported-launchjson-settings

There are show_hidden and max_data for it.

Sometimes too big values or no limited values in the settings can do deceleration of the system and then the debugging will be stopped.

like image 64
Oleg Dmitrochenko Avatar answered Sep 28 '22 13:09

Oleg Dmitrochenko