Skip to content
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

Show strings with newlines across multiple lines in debugger #3592

Open
mtaran opened this issue Nov 5, 2024 · 2 comments
Open

Show strings with newlines across multiple lines in debugger #3592

mtaran opened this issue Nov 5, 2024 · 2 comments

Comments

@mtaran
Copy link

mtaran commented Nov 5, 2024

Is your feature request related to a problem? Please describe.
I'm always frustrated when I am debugging and want to look at some multi-line input, but only get to see it squished to a single line with explicit \ns in it.

Describe the solution you'd like
I would like either a user preference for whether to escape newlines or not, or for them to be shown in escaped/unescaped forms in different parts of the UI, e.g. in the variables panel vs. on hover. Right now all the UIs show them with explicit \ns.

Describe alternatives you've considered
It would also be fine if I could use the debug console to print out the string, turning \ns into newlines. But call fmt.Println(...) errors out, and I couldn't find some alternative that would actually unescape the newlines.

Additional context
#1321 asked for the current behavior, but really the escaped/unescaped forms are useful in different contexts, so it'd be nice to have easy access to them both.

@mtaran mtaran changed the title Newlines in debugger show up as "\n" Show strings with newlines across multiple lines in debugger Nov 5, 2024
@gopherbot gopherbot added this to the Untriaged milestone Nov 5, 2024
@firelizzard18
Copy link
Contributor

firelizzard18 commented Nov 6, 2024

This is a delve issue. Unless you're using the legacy adapter, vscode-go does not control the presentation of variables. If delve adds a flag to control this behavior (whether to escape newlines/etc), vscode-go can add a setting to set that flag.

@h9jiang
Copy link
Member

h9jiang commented Nov 12, 2024

Hi mtaran, thanks for raising this issue. I believe firelizzard18 is correct. Thanks firelizzard18.

VSCode-Go delegates the debugging functionality via DAP to delv. VSCode-Go is responsible of figuring out the right configuration to delv and launching delv for debugging session.

From VSCode-Go side, we can certainly add a configuration field and pass this field eventually to delv to reach your desired behavior.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants