-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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 inspect compact #26269
Conversation
@BridgeAR sadly an error occured when I tried to trigger a build :( |
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.
Docs and tests LGTM, but I’m having a hard time reviewing the code itself
@addaleax I'll add a couple of comments to the code. I hope that'll help? And is there a specific part with which you struggled most / something that I should definitely explain? |
@BridgeAR Tbh, I’m having trouble with the string-building parts of the I think comments would be great, but comments with examples of how the calculation plays out in the end would be the most helpful thing here…? |
I just pushed another commit that includes a lot of documentation, further tests and it also improves the grouping logic further and makes sure array grouping and line combining does not happen at the same time. |
@addaleax @jasnell would you be so kind and confirm your LG due to the recent changes? @Trott @vsemozhetbyt it would be great if either of you could also review this. |
Documentation and tests LGTM. |
This overloads the `compact` option from `util.inspect()`. If it's set to a number, it is going to align all most inner entries on the same lign if they adhere to the following: * The entries do not exceed the `breakLength` options value. * The entry is one of the local most inner levels up the the one provided in `compact`.
When using `util.inspect()` with `compact` mode set to a number, all array entries exceeding 6 are going to be grouped together into logical parts.
2307913
to
2163a25
Compare
Rebased due to conflicts (besides that there were no changes, just the typo fixed). CI https://ci.nodejs.org/job/node-test-pull-request/21060/ ✔️ |
This overloads the `compact` option from `util.inspect()`. If it's set to a number, it is going to align all most inner entries on the same lign if they adhere to the following: * The entries do not exceed the `breakLength` options value. * The entry is one of the local most inner levels up the the one provided in `compact`. PR-URL: nodejs#26269 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
When using `util.inspect()` with `compact` mode set to a number, all array entries exceeding 6 are going to be grouped together into logical parts. PR-URL: nodejs#26269 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This overloads the `compact` option from `util.inspect()`. If it's set to a number, it is going to align all most inner entries on the same lign if they adhere to the following: * The entries do not exceed the `breakLength` options value. * The entry is one of the local most inner levels up the the one provided in `compact`. PR-URL: #26269 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
When using `util.inspect()` with `compact` mode set to a number, all array entries exceeding 6 are going to be grouped together into logical parts. PR-URL: #26269 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Notable Changes * n-api: * Implement date object (Jarrod Connolly) #25917 * util: * Add compact depth mode for `util.inspect()` (Ruben Bridgewater) #26269 * worker: * Improve integration with native addons (Anna Henningsen) #26175 * MessagePort.prototype.onmessage takes arguments closer to the Web specification now (Anna Henningsen) #26082
Notable Changes * n-api: * Implement date object (Jarrod Connolly) nodejs#25917 * util: * Add compact depth mode for `util.inspect()` (Ruben Bridgewater) nodejs#26269 * worker: * Improve integration with native addons (Anna Henningsen) nodejs#26175 * MessagePort.prototype.onmessage takes arguments closer to the Web specification now (Anna Henningsen) nodejs#26082
Please check the commit messages for a closer description.
The tests visualize the differences.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes