Skip to content
Advertisement

Limit value of array show in debug side bar

I’m trying to increase the value limit of an array in debug side bar.

By default, with an array with many elements, vscode only displays up to 32 values. I want to increase it to a certain number or unlimited.

This is my launch.json file:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "REP-M Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9001,
            "pathMappings": {
                "/var/www": "${workspaceRoot}",
            },
            "xdebugSettings": {
                "max_data": -1
            }
        }
    ]
}

But it seems that using max_data is incorrect.

So, how to increase it to a certain number or unlimited?

Advertisement

Answer

It’s the max_children setting instead, as per the documentation, which says “max_children: max number of array or object children to initially retrieve“.

In your config, you would use it like:

        "xdebugSettings": {
            "max_children": -1
        }

I would however not recommend that you set this to -1, in case you encounter a very large array.

Ideally, VS Code would allow for UI to fetch the next page of elements, instead of having to show them all at once, but from what I know, that is a limitation of VS Code itself, and not the plugin.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement