mike-ward / VSColorOutput

Color highlighting to Visual Studio's Build and Debug Output Windows
MIT License
429 stars 93 forks source link

Support for ANSI TTY Esc Colorization Codes #76

Closed smallscript closed 2 years ago

smallscript commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

I wonder if simply making another VS (channel) log-panel-window might be an easier more flexible solution then?

Thoughts...?

p.s., I can't remember at the moment what VS actually calls the set of panels that are grouped with build, etc. But I remember they are not too hard to create; it's been quite a while since I was on the Microsoft DevDiv Team working on VS.

Mike Ward mailto:notifications@github.com Saturday, July 14, 2018 8:00 AM

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mike-ward/VSColorOutput/issues/76#issuecomment-405028823, or mute the thread https://github.com/notifications/unsubscribe-auth/AKB-n-NELNx291-myHjY9Ow1F2d1anZNks5uGgefgaJpZM4VPtfj.

Khaos66 commented 2 years ago

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 bundle.js 7.91 MiB [emitted] (name: main)
1>  asset bundle.css 1.03 MiB [emitted] (name: main)
1>assets by info 530 KiB [immutable]

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 commented 2 years ago

@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 commented 1 year ago

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 commented 1 year ago

You could up-vote this https://developercommunity.visualstudio.com/t/Support-or-skip-ASCI-TTY-formatings-in-t/10251549