Xdebug for VSCode在预览中截断长变量

时间:2018-03-27 14:04:50

标签: php variables visual-studio-code xdebug truncate

当我使用Xdebug在VSCode中调试变量时,在预览鼠标悬停或检查面板中会截断长变量(如SQL语句)。

如何查看完整文本?

1 个答案:

答案 0 :(得分:1)

我有同样的问题和另一个问题(隐藏的子变量,只有 32 个内部变量不可见)。

更新您的启动配置 (.vscode/launch.json)。设置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
            }
        },
]}

查看所有参数:https://github.com/xdebug/vscode-php-debug#supported-launchjson-settings

它有 show_hiddenmax_data

有时设置中的值太大或没有限制值会导致系统减速,然后停止调试。