-
Notifications
You must be signed in to change notification settings - Fork 798
debug: Convert bytes to string #1459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I saw that several related issue was closed and I ask you not to close this one. Goland handles this behaviour and someone could implement this in |
I am using dlv-dap https://github.com/golang/vscode-go/blob/master/docs/dlv-dap.md
But I agree that it would be better we can skip this manual step. |
Using go's print formatters, which one would you like to see? There are:
We are getting the inlined value from delve's internal pretty-printer. To modify the inlined value, we would need to either modify it (and then dlv cli would see the same format change) or special case bytes in the dap server. It might be useful to display all of these options as "children" since it sounds like different users might find different formats useful. |
I would like to work with human readable |
Delve at the top of the tree has the following formatting feature:
It would be trivial to feed %q to the pretty printer to convert each byte to a character. |
There are a few options for how we could display the strings:
We can load the string representation and make it a child of the parent slice/array node. This would have the advantage of no extra configuration from the user. The possible downsides are the cost of calculating the string, and that not every byte slice makes sense as a string. To deal with the latter, we could have this be an option that can be turned on and off by the user.
This would be similar to how goland displays the string. We could have a special command that displays the string representation. This can be shown in a custom ui or printed to the debug console.
This is the current recommended workflow. It currently has some limitations with the load configuration but these can be fixed in the debug adapter by adjusting MaxArrayValues. |
@polinasok Is there anyway I can view hex values for byte/uint8 slices? |
You can define your own helper:
Then use it from WATCH or DEBUG CONSOLE:
It's not great. We really should do something better. Do you mind filing a feature request with what would be a better solution? Would you prefer an inlined version like we did for string? Or perhaps showing each character both as a decimal, as a hex and as a character?
|
Uh oh!
There was an error while loading. Please reload this page.
Is your feature request related to a problem? Please describe.
I'm debugging some code that works with the filesystem. My code uses
bytes.Buffer
and to see what content those bytes have I have to save bytes to real file, but as it terns out with JetBrain's "Goland" I don't have to do so.Describe the solution you'd like
I would like to see bytes as a string content like Goland does
related to
The text was updated successfully, but these errors were encountered: