-
Notifications
You must be signed in to change notification settings - Fork 449
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
Not working in VSCode debug console #218
Comments
Is this a colors issue or a vscode issue? microsoft/vscode#45572 |
Good question lol |
Closed, but worth reading the above link. What do you think |
@DABH any comments on this? |
Interesting; we should investigate the order in which ANSI codes are emitted (seems like we're doing it a bit backwards eh?). I'm not sure if there are any unintended consequences if we flip the order though -- seems like a core change so we would have to be very very careful. If you'd like to play around with this, feel free and let us know the results. It seems the VSCode people have largely gotten this working so I'll leave this open as a low-priority item to investigate in the future. |
Hey, just popping in incase you need me, I was the one making the most recent changes to the VSCode display stuff. The ordering problem does seem a bit weird to me, seems like it's almost more of a philosophical question than anything else. With the way that the class hierarchy works in the VSCode console HTML, I think it would require a decent redesign to account for more complicated cases where things are in different orders, though that may not actually be a bad idea. I haven't thought about it too deeply, but I can definitely think of more advanced situations where the current system wouldn't be sufficient. I'd be interested to know how many other debug consoles support your ordering as it stands, because if they all do, then it may be something that needs changing on our end. |
Oh my god. I found the problem. colors.supportsColor returns false on esm-enabled projects. That's not good. |
Ok that was premature, ignore. But I'm close |
colors.js/lib/system/supports-colors.js Line 69 in dc82cc0
My stream object has the _type property set to "pipe", instead of "tty". This makes the isTTY check fail, and I get no styling. The weird part is that a fresh node project has colors coming through somewhat alright, but in my main working project, I get no styling at all. There's something going on with my project's configuration that would create this issue, but I have no idea what. However my code looks like this:
And my launch.json looks like this:
In the meantime I'll use the "FORCE_COLOR" environment variable to fix this. I'm not sure if this is my fault, a bug with colors.js or a bug with VSCode... |
Bonus weirdness, works fine with another developer's project. I'm on OSX and he's on Windows 10. And I've double check I have the latest colors.js installed in mine. |
Thanks for investigating @jpike88 ! I've recently started triaging and going through all the issues and PRs -- things have already been cleaned up quite a bit in the past month or two. Custom colors is in the roadmap for the next minor release; we want to do it right, so it'll require some careful review, but this is definitely upcoming. We'd definitely welcome any help reviewing PRs like those, or PRs that fix any outstanding bugs (e.g. #167 seems similar to this issue). Meanwhile I've left some comments on #220 @danielfrankcom Thanks for dropping in : ) I believe colors works in at least a few other IDE debug consoles (e.g. Webstorm), but I haven't done a thorough investigation to determine support (an interesting project for someone to investigate!). colors is known to work in most console environments as well (Powershell, git bash, etc., etc.), so it does seem like a lot of systems do support this ordering of the color codes. Would be great, one way or another, to reach full compatibility with VSCode though! |
Please see my analysis of the problem: |
microsoft/vscode#71458, microsoft/vscode#70502, and microsoft/vscode#70935 fix a lot of issues with coloring text in the debug console. I would guess that if you try it again now, the problem will most likely be resolved. Let me know and if something else needs to be fixed on the VSCode side, I'll take a look at it. |
Any updates on this issue? I am able to repro the bug when used with Following are the version specs: Version: 1.55.1 |
This does not appear to be resolved to date |
@sheadawson @rahulmathews Can you provide an example? I am able to see colors in both the terminal and console. Using this basic script: const colors = require("colors/safe");
console.log(colors.green('hello')); |
Try this script const colors = require("colors");
console.log("hello".green.bold); String prototype function for color not working for me. It works in terminal though interestingly it fails while using node debugger in vscode. And Your code still shows the default blue color in debug console while using console log in my vs code |
This is my version specs:
|
The first image is how it looks in the debug console
The second image is how it looks in the VSCode integrated terminal (or normal OSX terminal)
The text was updated successfully, but these errors were encountered: