Skip to content
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

Support for ANSI TTY Esc Colorization Codes #76

Closed
smallscript opened this issue Jul 14, 2018 · 6 comments
Closed

Support for ANSI TTY Esc Colorization Codes #76

smallscript opened this issue Jul 14, 2018 · 6 comments

Comments

@smallscript
Copy link

smallscript commented Jul 14, 2018

Do you think it is reasonable/feasible to have it auto-detect ANSI TTY color codes and both hide the ANSI TTY codes and use them to colorize the text.

That would be awesome for simply streaming stderr output and other similarly embedded pre-colorized streams of data.

I'm interested in doing the work, but would like to know if the author thinks it is feasible.
See also this tool
And related comments
Visual Studio Marketplace comments

@mike-ward
Copy link
Owner

The output detection works differently than you might think. For instance, one can't actually set the output color of a line. One can only classify a line as a particular type that is associated with a color. The classification is sometimes ignored when there are conflicting circumstances. The other thing VS does not allow is changing the actual text of the output window. For instance, I've had several requests to suppress lines of output in the debug view. Can't do it because VS does not provide a hook to modify text.

So while a good idea, there would be no way to remove the escacpe sequences from the output. The sections could be colored but the escape codes would remain.

@smallscript
Copy link
Author

smallscript commented Jul 15, 2018 via email

@Khaos66
Copy link

Khaos66 commented Aug 24, 2022

This is an old issue but still valid.

In my case webpack produces a lot of colored console text like this:

1>assets by chunk 8.95 MiB (name: main)
1>  asset �[1m�[32mbundle.js�[39m�[22m 7.91 MiB �[1m�[32m[emitted]�[39m�[22m (name: main)
1>  asset �[1m�[32mbundle.css�[39m�[22m 1.03 MiB �[1m�[32m[emitted]�[39m�[22m (name: main)
1>assets by info 530 KiB �[1m�[32m[immutable]�[39m�[22m

When I run the command in a terminal (inside Visual Studio) the colors look fine!
When running as part of the build, the output window only shows the above uncolored message

@mike-ward
Copy link
Owner

@Khaos66 As stated above, there is no hook to modify the output text in the build window. This is limitation that Visual Studio imposes.

When I run the command in a terminal (inside Visual Studio) the colors look fine!

The terminal window has a terminal shell, the build window does not.

@smallscript
Copy link
Author

Writing an ANSI tty escape filter to remove them is a small amount of code. And not too much more to convert them to make calls to some internal API.

With that said, plugging such a small library into context is the real work.

@Khaos66
Copy link

Khaos66 commented Jan 12, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants