-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
util: improve display of iterators and weak entries #20961
Conversation
I like the change that adds the number of omitted items, but I feel inspection need to display what is to come from the iterator (i.e., what will be returned the next time one calls You might also want to do the same change to |
@TimothyGu the styling for Currently there is no special handling for |
I don't think we have an obligation to always follow what Chrome does, or at least I feel consistency in showing what's returned from URLSearchParams Iterator class has a custom inspection function, but I'd be more than okay to leave it out for another PR. |
@TimothyGu I gave it another thought and I agree with you. As soon as this PR is unblocked, I'll rebase and undo the changes to the inspection of Map#entries. |
4b92277
to
61cd6ba
Compare
fc452f9
to
acd59c3
Compare
This adds the number of not visible elements when inspecting iterators while exceeding `maxArrayLength`. It also fixes a edge case with `maxArrayLength` and the map.entries() iterator. Now the whole entry will be visible instead of only the key but not the value of the first entry. Besides that it uses a slighly better algorithm that improves the performance by skipping unnecessary steps.
acd59c3
to
591923b
Compare
CI https://ci.nodejs.org/job/node-test-pull-request/15894/ This is unblocked since the other PR landed. @TimothyGu I switched it back to the array notation for map entries and fixes a edge case that prevented the whole first entry from being visible in combination with |
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.
LGTM. Are you confident in this being a patch?
@mcollina I'd say it is a fix. It was never meant to only visualize the key in combination with |
It would be nice to get another review before this lands. |
This adds the number of not visible elements when inspecting iterators while exceeding `maxArrayLength`. It also fixes a edge case with `maxArrayLength` and the map.entries() iterator. Now the whole entry will be visible instead of only the key but not the value of the first entry. Besides that it uses a slighly better algorithm that improves the performance by skipping unnecessary steps. PR-URL: nodejs#20961 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in 81bc23f 🎉 |
Should this be backported to |
This adds the number of not visible elements when inspecting iterators while exceeding `maxArrayLength`. It also fixes a edge case with `maxArrayLength` and the map.entries() iterator. Now the whole entry will be visible instead of only the key but not the value of the first entry. Besides that it uses a slighly better algorithm that improves the performance by skipping unnecessary steps. PR-URL: #20961 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This is based on #20831 and I am going to rebase when that lands.
This patch changes the way how map iterator entries are displayed by
using the same style as for regular maps. It also improves iterators
in general as well as WeakSets and WeakMaps by indicating how many
entries in total exist. This information was not available before but
due to the new preview implementation it is now available and should
be displayed as well.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes