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

ANSI colors in OutputChannel #571

Closed
seanmcbreen opened this issue Nov 24, 2015 · 40 comments
Closed

ANSI colors in OutputChannel #571

seanmcbreen opened this issue Nov 24, 2015 · 40 comments
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code output Output channel system issues
Milestone

Comments

@seanmcbreen
Copy link

From @SamVerschueren on October 30, 2015 6:9

I might have seen a post regarding styling of the OutputChannel, but not sure though.

I think it would be a nice feature to support ANSI colors. This way libraries like chalk can be used to style the output. Another benefit is that if you develop a plugin like Yeoman, who outputs to the console, the output can be directly passed to the OutputChannel.

Not sure if this is possible, but I think it would be a nice feature. No need to implement our own styling stuff in the channel, just use libraries that already exist.

Copied from original issue: Microsoft/vscode-extensionbuilders#69

@seanmcbreen
Copy link
Author

From @bpasero on October 30, 2015 7:16

Yes, this is on the plan for post November.

@seanmcbreen
Copy link
Author

From @SamVerschueren on October 30, 2015 7:16

Awesome, great job!

@daviwil
Copy link
Contributor

daviwil commented Nov 24, 2015

Excellent!

@orta
Copy link
Contributor

orta commented Nov 29, 2016

As there's not been too much activity on this thread, I'd like to drop a +1 - I was comparing some of my extension's output from the debug console to it's user's Output Channel and would love to be able to show colour in there.

screen shot 2016-11-29 at 10 46 42

screen shot 2016-11-29 at 10 46 45

@abotsi
Copy link

abotsi commented Feb 9, 2017

Up!
Is there anything new on this side? Do you have an idea of why a such feature cannot be added?

@orta
Copy link
Contributor

orta commented Feb 9, 2017

To provide a workaround, you can create a custom log syntax for the output - see https://github.com/IBM-Bluemix/vscode-log-output-colorizer

@abotsi
Copy link

abotsi commented Feb 10, 2017

Thank you @orta for your quick response, but the extension you proposed did't enhances my situation. Actually, my problem is I don't get anything from ProgressBarPlugin when I bundle my project with WebPack with VSCode task, whereas I get a nice print when I run the command from a terminal...

Output panel (actual) :
output panel - actual

Terminal panel (expected) :
terminal panel - expected

I don't know if it's directly related with issue (this plugin WebPack use chalk, which could be the problem), maybe I should create another thread...

@orta
Copy link
Contributor

orta commented Feb 10, 2017

I was noting that you could write a colorizer yourself, not that it would help you right now.

@erichiller
Copy link

+1 this - seems to be possible to render the ansi in the same method as the internal termimal - in fact I would prefer it this way! Because then my variables and other environment configs I define within that environment become available.

@jbcpollak
Copy link

jbcpollak commented Jul 30, 2020

pytest output is next to impossible to debug without this feature. Please consider re-opening it. For now I've resorted to running pytest on the terminal and just ignore the IDE integration entirely.

@sn0wf4ke
Copy link

yes. for pytest it would be a great enhancement on usability.

@paxcodes
Copy link

@jbcpollak @sn0wf4ke I also use Pytest and would love to have this feature. There is an existing issue over at vscode-python repo. microsoft/vscode-python#12615

Giving the issue a thumbs up would help as one of the maintainers say,

how many 👍 votes the opening comment gets [..] help us make our decision.

@bconway
Copy link

bconway commented Nov 23, 2020

I would love to take this out of my (logging) code:

// VSCode does not support colors in the output channel:
// https://github.com/Microsoft/vscode/issues/571
NoColor:    true,

@nrhoffmann
Copy link

I'd recommend using an extension pseudoterminal.

Documentation is a little scarce. See ShMcK/vscode-pseudoterminal for a simple example of this in use.

@malmod
Copy link

malmod commented Dec 30, 2021

Please reopen this!

@OliverScherf
Copy link

We really need this! Reopen please.

@rollingmoai
Copy link

+1 for this!

@Bi0max
Copy link

Bi0max commented Sep 9, 2022

+1 for this!!

@Rickaym
Copy link

Rickaym commented Sep 15, 2022

+1 for this!

2 similar comments
@m-paternostro
Copy link

+1 for this!

@dongxuan
Copy link

+1 for this!

@Tantol
Copy link

Tantol commented Dec 28, 2022

+1

@ghadesi
Copy link

ghadesi commented Jan 4, 2023

Please, re-open this issue. It could be super helpful for the pytest tests.

@JamyDev
Copy link

JamyDev commented Jan 6, 2023

@isidorn Would you be able to bring this issue up for reconsideration? I know it's an old one, but we're integrating with Test Explorer and that uses the OutputChannel for our build+test output. Would be nice to have ANSI support.

@isidorn
Copy link
Contributor

isidorn commented Jan 6, 2023

@JamyDev would be great if you can open a new issue. I am not sure if this is something we will tackle any time soon though.

@MohamedLamineAllal
Copy link

MohamedLamineAllal commented Oct 29, 2023

I made a year ago and half a proof of concept of something that cleans the ansi colors code clutter mess in output channels. A day work or something. And since then it was buried in my laptop. Two days ago i went through the repo. And got curious. I thought the problem would have been fixed with newer vscode versions. Surprised it's not yet ❗

And absolutely, something that allows optional opting to activate or disable ansi colors codes interpretation, should be supported by vscode. Or an API that allows extension to manipulate existing channels. And editing text and its decoration. And that's because many of the extension and CLI tools use ANSI color codes, as they are meant for the Terminal.

  • Giving the situation. I decided. I'll try to publish something workable, maybe some will find it helpful. And not leave it buried in my laptop. From willing to just publish something. I ended by working out a fully optimized extension. That works and tackles the problem well. I did that yesterday.

Check it out

The documentation details all. Including the core ideas of the solution. And a full showcase.

image

image

@MohamedLamineAllal
Copy link

MohamedLamineAllal commented Oct 29, 2023

I did some extra validation. And i see myself able to fully support ansi colors codes colorization. I'll try to handle that on the weekend.
Idea

  • Use editor decoration. All Output panels are editors. And are accessible through vscode.window.visibleTextEditors, Fully validated with the usage of setDecorations()
image
  • I just need to check and validate Output channel change event (editor something) and the ranges handling.

@iBicha
Copy link

iBicha commented Feb 26, 2024

Please reopen this issue - the need for this will not magically disappear, thanks

@ffMathy
Copy link

ffMathy commented Mar 13, 2024

@jrieken could you provide some justification as to why this was closed as out-of-scope? There are many who still need it, so an explanation would be great.

@microsoft microsoft locked and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code output Output channel system issues
Projects
None yet
Development

No branches or pull requests