delve icon indicating copy to clipboard operation
delve copied to clipboard

Feature: Add possibility to configure max string/bytes limits for on-demand content loading for debug

Open crisperit opened this issue 5 months ago • 3 comments

Context I've read the issue https://github.com/golang/vscode-go/issues/1318 and I'd like to go back to a topic of truncating the long strings..

And in mine case these limits are not sufficient so as @polinasok said in https://github.com/golang/vscode-go/issues/1318#issuecomment-904366663 I'm letting you know :D

I'm working on a huge payload which comes as []byte and sometimes is visible as a string According to a https://github.com/go-delve/delve/blob/f498dc8c5a8ad01334a9d782893c10bd0addb510/service/dap/server.go#L289 and https://github.com/go-delve/delve/blob/f498dc8c5a8ad01334a9d782893c10bd0addb510/service/dap/server.go#L2919 it's not possible to change it via the config.

I'm using VSCode extension and created topic there (https://github.com/golang/vscode-go/issues/3795#issuecomment-3115090298) For me using newest adapter is a bit useless as I constantly am hitting the limit and I need to create bunch of Println which is rather not sth that should be done..

Requested feature description I like the idea of having different limits depends on context - it's good for the performance. But the hardcoded logic limits are sth bad. I would like to have on-demand configurable max idea

I would like to be able to configure different kind of limits (but only for on-demand) context

maxStringLen: Maximum number of bytes read from a string (default: 64).
maxArrayValues: Maximum number of elements read from an array, slice, or map (default: 64).
maxStructFields: Maximum number of fields read from a struct. A setting of -1 indicates that all fields should be read (default: -1).
maxVariableRecurse: How far to recurse when evaluating nested types (default: 1).
followPointers: Automatically dereference pointers (default: true).

crisperit avatar Jul 27 '25 17:07 crisperit

I don't think that maxVariableRecurse and followPointers make sense here and maxStructFields probably doesn't make sense in general. The rest, maxStringLen and maxArrayValues, sound reasonable to me. It's unfortunate that there is no "load more" request in DAP.

aarzilli avatar Jul 28 '25 14:07 aarzilli

Ah right - I've just copied the legacy config but you're right only maxStringLen and maxArrayValues makes the sense. Regardless of that in mine opinion it might be a high value feature - at least I know a few programmer that are missing it

crisperit avatar Jul 28 '25 17:07 crisperit

there is already a fix for this, we need 3 pull requests to be accepted in 3 different repos, but it might look like this https://github.com/golang/vscode-go/issues/3817#issuecomment-3170404359

MistaTwista avatar Aug 09 '25 11:08 MistaTwista