-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Improve console.group in Debug Console #34981
Comments
Our console for sure would gain much with simple object formatting / tree structure. Is the debug console rendering virtualized today? |
The debug console is based on a tree, so this should be simple to implement. |
@roblourens is the I was able to achieve the following with the existing DAP: So, the only issue is the array index that appears in front of the stack frames (but we could call this a feature). The missing link detection is an orthogonal issue that we will fix anyway. |
The markup is just something I added so the group/groupEnd calls aren't totally invisible. My original example isn't the best example, it's logging a single item as a one-off group. In your screenshot it looks like you're logging an array of strings, which is possible, but I don't think it's the right model for logging a group.
|
What are "good" examples for a dynamic group? |
Code like console.log('foo 1');
console.group('group 1');
console.log('foo 2');
console.log('foo 3');
console.group('group 2\nmultiline group\ntitle');
let i = 0;
const interval = setInterval(() => {
console.log('bar ' + i++);
}, 1000);
setTimeout(() => {
console.groupEnd();
console.log('ended group 1');
console.groupEnd();
console.log('ended other group');
}, 4000) Looks like this in chrome devtools By "log location" I mean the location that we added for each log last month. |
I just discovered console.group and console.groupCollapsed for using in my react native project and was surprised they didn't actually group with the collapsible arrow like logged objects do. PLEASE implement good visual collapsible grouping sooner rather than later. Although not "critical", it's such a simple thing and will improve my quality of dev-life :) |
This is open for over one year... Any updates on this? Are we waiting for vscode to support Grouping? |
@weinand I didn't want to just add a Safari:Chrome:VS Code:This is so verbose and unclear (especially with the additional whitespace after |
If you "would really like this to happen", you could submit a PR... ;-) |
Haha, of course, but it's not an option with our current work pipeline. Plus, I wouldn't know where to start! Am I mistaken in thinking you had something of a partial implementation, mentioned in #34981 (comment)? |
Same issue here. Debugger console is unusable with redux-logger. |
@weinand how did you get the expand/collapse output in the debug console shown in #34981 (comment)? As far as I can tell, |
@DanTup this is just an |
@isidorn An additional aspect of groups is that after a group has been created with a specific name, later console output can be appended to the group if the same name is used. |
@weinand, @isidorn: I might have confused you wrt names. Console groups are not named, they are synchronous grouping and there is no way to add to the group post-groupEnd. A better example would be a console group that was opened for a very long time (forever). Now all the console output should be getting into that group, so we need to dynamically populate a second level of the object tree. Unrelated and FYI:
|
Not going to happen in november due to lack of time. Removing the Milestone and I leave it up to @weinand to assign a new milestone and to drive the changes in the DAP needed for this. |
I have experimented with what Chrome can do and came to the same conclusions as @roblourens already pointed out. We would need to introduce a optional new field in the Some more details: @roblourens @weinand @connor4312 let me know what you think. Thanks! |
The One alternative would be to treat these as variables and use the existing variablesReference. We would need two things for that:
With these, I think groups could be implemented without needing explicit knowledge of grouping. This might be more generalized, I can't recall encountering log 'grouping' in other languages. The ability to update existing output variables might(?) be interesting to have elsewhere. This would let us implement |
This is proposed above too, one thing missing is that the log messages also have source locations associated with them, which a variable in an array wouldn't. Also the group can change after it is first displayed. An array can change after it is logged too, but usually users don't expect objects that they previously logged to change on them. |
Since the node.js API has already a A client implementation can decide whether it wants to show the group name (which I prefer), or whether it just uses it for implementing the grouping. What is not clear to me is whether the |
The group name can be represented as the existing output/variables reference. In console.group, you can also use non-strings there, I think it would make sense to treat it as a 'normal' output event with a group identifier (rather than using the group as a display string to a user). Making the
If I'm reading Isi's proposal correctly with "the first OutputEvent with a group set as the parent in the tree that can be expanded / collapsed to show all the other content that has the same group set", I think we need the explicit end, otherwise in
...we would not be able to tell that that Regardless of what direction we go I would like to see if we can figure out a way to implement groupCollapsed as well, as that's used in several real-world tools like redux-logger above. |
@connor4312 in your case the adapter would have to send the following event before My proposal does not cover the
|
I think that if we want to get a solution for console grouping, we should try to find a design that can support it fully to avoid hacking things on later 🙂 I think the group object like you have makes sense, but that will become verbose if added to every output event, and the collapsed flag only has meaning on the first event of the group. Maybe
|
Adding this to the February milestone since it is on the plan. |
My summary of the node.js console.group documentation:
My DAP proposal: We add an optional enum property
|
For further discussion of the group feature in the DAP, I've create this issue. |
@isidorn I've added a group attribute to DAP and updated |
I have pushed support for this. @weinand thanks for adding the protocol! @connor4312 @roblourens it would be very cool if the node2 or the javascript debugger could support console groups this milestone, then we could add a test plan item which uses node and not mock debug. Anyways let me know how it goes, so I prepare a test plan item in time. Thanks! |
It would be a 💪 to do in the remaining days this iteration, but the test plan could literally for Rob or I to implement and verify grouping in js-debug. Andre has written a few items like that for me in the past 🙂 |
@connor4312 writing a test plan like that would work for me. Let's see the status on this tomorrow evening and I will update the test plan accordingly. Thanks! |
Great idea to implement the protocol for js-debug as part of the test plan item ;-) |
vs
Can we introduce a concept like this into the debug protocol, and improve the display to support collapsible sections of logs? Do other runtimes have a concept like this?
It's now more visible when debugging vscode.
The text was updated successfully, but these errors were encountered: