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
Unstripped Ansi Color Codes in Metals Output #2621
Comments
So I'm not 100% sure this is something Metals is actually doing wrong. For example this is just displaying what we are piping to our own log file, and if you tail that file in your terminal (most terminals that is), you'll see it colored correctly. I don't believe it should be any different than the way that DAP output is colored in the DEBUG CONSOLE. I'd expect the OUTPUT panel to pick this up, although I'm not familiar with VS Code. It may be worth just digging into that a bit to see if that is indeed an issue on the VS Code side, unless we do anything to it in the VS Code extension. |
Thanks for reporting! @ckipp01 might be right here. We could strip the color in VS Code output itself (which would mean it's a VS Code specific issues). Tailing it in the terminal shows the colors properly. Digging into it a bit further it seems that the issue in VS Code was clsoed without a resolution: microsoft/vscode#571 What we can do is either strip colors when writing to output in VS Code (or via a setting in Metals) or you can actually use https://github.com/IBM-Cloud/vscode-log-output-colorizer which is an extension to VS Code and seems to work fine: I think the second option with the additional workaround gives us much more possibilities. Alternatively, since the extension is quite short we can include it along with the license in metals-vscode. |
Actually, that doesn't strip out the ANSI escape codes. We might need to use |
It seems that it's actually being done in LanguageClientLogger - we might need to strip the ansi escape codes there using LineListener |
For general Unix hygiene, it's definitely wrong to write ANSI colour escape codes into a log file. They should not be written to anything unless isatty returns true. |
Describe the bug
The Scala 3 compiler produces colored error messages that are not correctly displayed in VS Code Metals output:
To Reproduce
Steps to reproduce the behavior:
Metals: attempt to generate BSP config for build tool
command to connect to sbt serverView > Output > Metals
panelExpected behavior
The color codes should be stripped or displayed.
Screenshots
Installation:
Additional context
The color codes of the
Debug Console
are correctly displayed so they should not be stripped.Related PR: #2615
The text was updated successfully, but these errors were encountered: