vscode-php-debug icon indicating copy to clipboard operation
vscode-php-debug copied to clipboard

Variable gets truncated

Open PipCodeBoy opened this issue 8 years ago • 6 comments

Why do variables get truncated and not show the full value? Is there any way to change this to show the full variable value?

image

PipCodeBoy avatar Apr 17 '18 10:04 PipCodeBoy

Please refer to the XDebug documentation, the adapter doesn't truncate it, it's XDebug. You can customize XDebug settings through launch.json. They get truncated because else big variables can easily slow down the debugger.

felixfbecker avatar Apr 17 '18 18:04 felixfbecker

And where do I find the parameter to add to launch.json that fixes that?? Thanks

PipCodeBoy avatar Apr 18 '18 05:04 PipCodeBoy

@PipCodeBoy

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9000,
      "pathMappings": {
        "/app/": "${workspaceRoot}"
      },
      "xdebugSettings": {
        "max_data": -1,
        "max_children": -1
      }
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9000
    }
  ]
}

skippednote avatar Jun 11 '18 08:06 skippednote

@skippednote That worked but now VSCode is having a hard time displaying 132 attributes 😑

image

ww9 avatar Mar 04 '20 12:03 ww9

Same with strings, while I can now copy and paste the value in full with the new settings (thank you for that example by the way). I cannot actually see the data within vscode.

ccjjmartin avatar May 26 '21 19:05 ccjjmartin

I had a similar issue with xdebug 3 and vscode 1.66.2 on Ubuntu 20.04.4 (and vscode ext "PHP Debug" 1.26.1). @skippednote pointed me on the right solution. just replace "-1" (does not work for my env: it completely truncates the variables) with a higher value (like 9999).

      "xdebugSettings": {
        "max_data": 9999,
        "max_children": 9999
      }

tested with 2 different config (listening for xebug and build in server) with the same result. working with magento 2 we have some very big objects and this solves it nicely. cheers!

rumbdev avatar Apr 26 '22 09:04 rumbdev