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
Support watching lists in debugger #27628
Conversation
…lement for non-array watch values
ab7ea4f
to
34c04bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason we don't want long string values to wrap also?
let parsedArray = ''; | ||
array.forEach((element, index, array) => { | ||
if (element === null) { | ||
parsedArray = parsedArray + 'null'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: += would be more concise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Was still thinking in python from teaching in the AM. :)
if (element === null) { | ||
parsedArray = parsedArray + 'null'; | ||
} else if (Array.isArray(element)) { | ||
parsedArray = parsedArray + 'list (' + element.length + ')'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should/could this recursively parse so that watching a list of lists would show you the contents of all the lists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also interested in this^?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided not to for a couple reasons:
-
It starts to look confusing when you have multiple lists or multiple levels of nesting in a list. The way our UI currently is set up, you end up with a bunch of commas, and it's difficult to figure out which array each element belongs to.
-
I checked how the chrome debugger handles this case, and it does something similar. It doesn't expand nested arrays by default. (the exception to this is it will if there is only a single level of nesting)
Chrome example:
It would be nice, but with the way the spacing is currently set up, there isn't a graceful way for it to be vertically centered both when the string is short and when it wraps. The array formatting cheats a little because it will always be a multi-line display. I'm opening a ticket for this in the backlog, however. It also might be worth revisiting how this watch window is set up. |
No description provided.