-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: highlight stack frames #27052
util: highlight stack frames #27052
Conversation
I'm guessing those added tests do not run on Windows? I think we'd need to test there as well. |
Looking at your screenshot, it feels like the |
I played around with it and I originally implemented it the other way around. I choose this in the end since yellow is darker than the white frames and the last frame in the stack will likely be a userland frame and that works well with the error message that is not highlighted. I am also fine to land this in two PRs: first grey out Node.js core frames and later distinguish |
That’s really dependent on your terminal and terminal settings, and in particular, we’ve had reports of yellow being hard to read on a bright background. Maybe it would help if you could explain why it is important to distinguish |
Definitely. Here is an overview for different terminals and how their colors would look like: https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit Yellow is indeed relatively dark. I originally choose that on purpose as I expect people to mainly focus on their own code and that errors hopefully come mainly from their own code and not from modules that they use.
I would like to immediately see what node_module was used without having to look more closely at the stack. That's why I differentiated both. Here a couple of screenshots from alternatives that I checked as comparison. I do not believe that this solution is the best or that there is "a best" solution only that this is an improvement over the current situation. There's still significant room for improvement. If anyone would rather have a different solution, please let me know! I guess we could just set up a small poll and vote in that case? I added another safe guard against detecting non core frames as such by checking if the file is indeed a NativeModule. I also added cross platform tests and updated the documentation. @nodejs/util @bnoordhuis @devsnek @addaleax PTAL |
I marked this as semver-minor as it feels like a feature addition. |
i like the white bold one |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It's a bit hard to actually identify the differences with it, don't you think so? And are you also fine with the PR as it is? |
@nodejs/util PTAL. I think this quite a nice feature and it would be great if this could land soonish :) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I like the general idea but would make it easier for the user to modify the styles l for each. I know users can already modify the color scheme, but allowing them to select the specific style allows for more variation |
Can you elaborate? The Do you want the user to also modify the default part (the regular white part)? |
Ping @jasnell. I am not sure what exactly you'd like the user to modify. |
Using `util.inspect` on errors is going to highlight userland and node_module stack frames from now on. This is done by marking Node.js core frames grey and frames that contain `node_modules` in their path yellow. That way it's easy to grasp what frames belong to what code.
Using
util.inspect
on errors is going to highlight userland andnode_module stack frames from now on. This is done by marking Node.js
core frames grey and frames that contain
node_modules
in their pathyellow.
That way it's easy to grasp what frames belong to what code.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes