Executing CMake or the build command in a terminal shows it nicely formated with bold and colors. Is there anything that this extension can do to support this? Currently all output goes to the output pane which shows just Black&White output which makes it hard to read.
I've seen that task output is redirected to the terminal pane which does support coloring (since a bit ago), could this extension support this too? Or is there another option?
This might also be worth noting in the FAQ.
The output channel gives no coloring options, so that's not going to work. A terminal supports ANSII, so that's the only way to do it at the moment. Running the build as a VSCode Task has proven difficult, but may be possible. There's a pending ext API in VSCode to have "custom terminals" where an ext can write bytes directly to a terminal window. That will _probably_ be the route I go with in the future, but it's an open question.
Any news on this? I use a task like this as a workaround:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "process",
"command": "ninja",
"options": {
"cwd": "${workspaceRoot}/build"
},
"group": {
"kind": "build",
"isDefault": true,
},
"problemMatcher": [
{
"base": "$gcc",
"fileLocation": ["relative", "${workspaceRoot}/build"]
},
],
"promptOnClose": true
}
]
}
Sorry, no update yet. When this task is assigned a Milestone with a product version number, you will know that we are working on it.
I was also asking if there's a clearer way forward than indicated in the last comment. But it seems there's not. The relevant vscode isssue is https://github.com/microsoft/vscode/issues/571. See also https://github.com/microsoft/vscode-cmake-tools/issues/119#issuecomment-282030750.
However, I found that a better workaround is to just install the Output Colorizer extension and things just work for me: https://marketplace.visualstudio.com/items?itemName=IBM.output-colorizer
This would be a really nice thing to add. Right now, I just prefer to do ctrl + j , go to the terminal and just type make manually to have the colorized build...
I also miss this a lot, but more because of CTest.
Colors in the CTest output are invaluable for quick iterations !
For me, the Output Colorizer plugin from IBM is working pretty good. You might give it a try. Never tried it with CTest though...
I tried it but the colors are not the ones that should be shown, it seems
to just parse the text with regexps?
That's different from using the ascii color tags.
Le jeu. 9 janv. 2020 à 12:03, Nuno Sá notifications@github.com a écrit :
For me, the Output Colorizer plugin from IBM is working pretty good. You
might give it a try—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode-cmake-tools/issues/478?email_source=notifications&email_token=ABN6YIIJUJQPJPTX67Z6NJDQ4376XA5CNFSM4FJ2ALLKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIP5GUQ#issuecomment-572511058,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABN6YIP6DUBSYXC2YM65PWDQ4376XANCNFSM4FJ2ALLA
.
This isn't a general solution for just running CMake builds but if you're writing your own cmake scripts, I've had good luck with peppering these into my message() functions:
# Colorized Output Setup
if(NOT WIN32)
string(ASCII 27 Esc)
set(Reset "${Esc}[m")
set(Bold "${Esc}[1m")
set(Red "${Esc}[31m")
set(Green "${Esc}[32m")
set(Blue "${Esc}[34m")
set(Cyan "${Esc}[36m")
set(Magenta "${Esc}[35m")
set(Yellow "${Esc}[33m")
set(White "${Esc}[37m")
set(BoldRed "${Esc}[1;31m")
set(BoldGreen "${Esc}[1;32m")
set(BoldBlue "${Esc}[1;34m")
set(BoldCyan "${Esc}[1;36m")
set(BoldMagenta "${Esc}[1;35m")
set(BoldYellow "${Esc}[1;33m")
set(BoldWhite "${Esc}[1;37m")
endif()
Then just use them like so...
message(STATUS "${Cyan} Here's some status...${Reset}")
message(DEBUG "${BoldYellow} Debugging some nonsense...${Reset}")
message(ERROR "${BoldRed} I hope you like Bach because your script is Baroque...${Reset}")
I've only tested this on xterm-256color.
FYI: The colors do carry over between messages because you're actually manipulating the terminal. So always do the ${Reset}.
Another issue with having the build output in "output" is that the errors are not clickable.
Another issue with having the build output in "output" is that the errors are not clickable.
This is caused by relative paths. You can workaround this by setting "cmake.buildDirectory": "${workspaceFolder}/../build" in your workspace settings.json.
can we run the build command inside a terminal or have an option for that? the run button already does that and it would be cool to have the build button does that too for the output to be colorized.
Most helpful comment
For me, the Output Colorizer plugin from IBM is working pretty good. You might give it a try. Never tried it with CTest though...