You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
console.table output in debug console loses its colors when using launch program #168924
It works if you set "console": "integratedTerminal". I think that is just the behavior of console.table- it only sends colors if the program is detected to be running in a tty environment that it knows can interpret them.
roblourens sorry one more question on this. If I hit F5 on a new script and there is no launch.json file, it launches the script in debug mode, which is nice and easy, but I lose the colors. Is there a way to have the default behavior, — without creating a launch.json script — be to use this integratedTerminal option?
Also, it seems that F5 will launch the script specified in the "main" field of my package.json. Is there a way to have F5 run the currently active script, whatever that may be?
My ideal workflow would be to use F5 / Shift-F5 to start / stop the current script I'm working on and to show console output with all of the supported colors. Thanks for your help.
Thanks for letting me know. I could break this into a few issues if it's something possible to pursue. I don't know the debug architecture well enough to know how well properly tailored these are but here is a start of two issues I can open if they aren't completely off base and not feasible.
"Allow for global debug settings" These settings would apply to debug sessions started by F5 for projects without a launch.json. This would allow me to set the integratedTerminal option as the default.
"If no launch.json, F5 debugs current active file." I think I was mistaken that F5 runs the debug script on what is specified in the package.json. I can't actually quite figure out how it chooses which script to run. What is the current logic?
[edit I was able to have F5 run the current file, as described in the docs, by changing the dropdown in the debug console to be "Run current file" instead of "Launch program"]
I found one more inconsistency when it comes to color highlighting. I can open a new issue if that helps but maybe I'm simply doing something wrong.
When using "console": "integratedTerminal", and I console.table` an array of objects, I get the nice coloring. But if I just console.log a string and a number, they show up both in blue
Same deal, the coloring in the terminal is on the "frontend", the debug messages that we get don't contain any color information, and vscode doesn't apply any colorization to debug console messages by default. I'm not sure it makes sense for vscode to do that for all messages generically. I think it would have to be a feature request for js-debug, if you think that we should be coloring these messages.
Ah that's too bad – I thought setting "console": "integratedTerminal" would fix it in all scenarios. I'm not sure I would ever not want it to be colored but I imagine there is some computation cost?
As background, I think the REPL is super useful and am using more and more for Jupyter-style cell-like execution but without the whole added infrastructure of that setup. Bringing the interactive REPL to node programming opens up so many possibilities.
Even if it were something you could set in .vsode/launch.json that would be great – I would just set up my script template with that flagged. Is that this repo? I can file an issue there if that's the most appropriate place.
Activity
roblourens commentedon Dec 13, 2022
It works if you set
"console": "integratedTerminal". I think that is just the behavior of console.table- it only sends colors if the program is detected to be running in a tty environment that it knows can interpret them.mhkeller commentedon Dec 13, 2022
Thanks!
mhkeller commentedon Jan 10, 2023
roblourens sorry one more question on this. If I hit F5 on a new script and there is no
launch.jsonfile, it launches the script in debug mode, which is nice and easy, but I lose the colors. Is there a way to have the default behavior, — without creating alaunch.jsonscript — be to use thisintegratedTerminaloption?Also, it seems that F5 will launch the script specified in the "main" field of my package.json. Is there a way to have F5 run the currently active script, whatever that may be?
My ideal workflow would be to use F5 / Shift-F5 to start / stop the current script I'm working on and to show console output with all of the supported colors. Thanks for your help.
roblourens commentedon Jan 11, 2023
I don't think we have something like this currently, cc Connor Peet (@connor4312) to be sure
connor4312 commentedon Jan 11, 2023
Correct, we don't currently support that
mhkeller commentedon Jan 11, 2023
Thanks for letting me know. I could break this into a few issues if it's something possible to pursue. I don't know the debug architecture well enough to know how well properly tailored these are but here is a start of two issues I can open if they aren't completely off base and not feasible.
launch.json. This would allow me to set theintegratedTerminaloption as the default."If no launch.json, F5 debugs current active file." I think I was mistaken that F5 runs the debug script on what is specified in thepackage.json. I can't actually quite figure out how it chooses which script to run. What is the current logic?[edit I was able to have F5 run the current file, as described in the docs, by changing the dropdown in the debug console to be "Run current file" instead of "Launch program"]
mhkeller commentedon Jan 17, 2023
I found one more inconsistency when it comes to color highlighting. I can open a new issue if that helps but maybe I'm simply doing something wrong.
When using

"console": "integratedTerminal", and I console.table` an array of objects, I get the nice coloring. But if I just console.log a string and a number, they show up both in blueversus green and yellow when put into a table
roblourens commentedon Jan 17, 2023
Same deal, the coloring in the terminal is on the "frontend", the debug messages that we get don't contain any color information, and vscode doesn't apply any colorization to debug console messages by default. I'm not sure it makes sense for vscode to do that for all messages generically. I think it would have to be a feature request for js-debug, if you think that we should be coloring these messages.
mhkeller commentedon Jan 17, 2023
Ah that's too bad – I thought setting
"console": "integratedTerminal"would fix it in all scenarios. I'm not sure I would ever not want it to be colored but I imagine there is some computation cost?As background, I think the REPL is super useful and am using more and more for Jupyter-style cell-like execution but without the whole added infrastructure of that setup. Bringing the interactive REPL to node programming opens up so many possibilities.
Even if it were something you could set in
.vsode/launch.jsonthat would be great – I would just set up my script template with that flagged. Is that this repo? I can file an issue there if that's the most appropriate place.