-
Notifications
You must be signed in to change notification settings - Fork 647
-
Notifications
You must be signed in to change notification settings - Fork 647
Long strings in variable inspection get truncated #868
Comments
So it looks like vscode uses v1 of the delve API: https://github.com/derekparker/delve/blob/master/service/rpc1/server.go Unfortunately, v1 does not allow the client to change the default length of the variable value, which is set to 64 bytes. As a workaround, we can simply change the source of delve to return more than 64 bytes. 1.) Navigate to %GOPATH%\src\github.com\derekparker\delve\service\rpc1\server.go 3.) Compile and install your modified version of delve. Navigate to %GOPATH%\src\github.com\derekparker\delve\cmd\dlv, and then run the command: go install. |
Any idea why this hasn't been merged yet? |
@edburns this is a hack in the delve debugger rather than a fix on the extension side To fix this on the extension we have to use the delve v2 api call instead of the old one: The place to make the change is here. I'm trying to take a look at it |
Why isn't there debug string length key with a value for this in settings that we can just set instead? |
@jgfet because the original delve API did not support this in an explicit way and the vs debug adapter used that version, hence the need to add support to v2 as explained in #1555 The work is already merged to master (still to be released) and the new launch.json configuration options can be seen here: https://github.com/Microsoft/vscode-go/blob/master/package.json#L421-L464 |
With #1555 now complete (thanks to @lggomez!), this bug can be fixed when using the latest update to the Go extension (0.6.81) Just update your debug configuration as per #1555 (comment) |
When trying to debug a long string, it gets truncated, and trying to copy it using the right-click context menu, returns the actual truncated value, with "...74 more" string.
VSCode itself adds ellipsis in that element when it's too long, maybe should directly print here the full length variable. Or, at least, when using the "Copy value" context menu, copy the real (and full length) one.
Seems like this happens because Delve returns a 'Len' prop shorter than the actual one, and this is like this by design: https://github.com/derekparker/delve/issues/659#issuecomment-256945278
The text was updated successfully, but these errors were encountered: