-
Notifications
You must be signed in to change notification settings - Fork 459
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
Colorized CMake/Build output #478
Comments
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 microsoft/vscode#571. See also #119 (comment). 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. |
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
<#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:
Then just use them like so...
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 |
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 |
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. |
Any update on this? I really miss seeing some color when building. |
@daeden, unfortunately we were not able to get to this feature yet. If anyone is willing to implement this request, we are willing to review and test a PR. |
@andreeis, How about having an option to run the build command inside the terminal instead of the output window? That should be easy to do. |
You should be able to work around this by using the
|
While this does appear to accomplish redirection of output to a terminal tab, testing shows that it comes at a great cost:
|
I understand that this is not for everyone, but I switched to Meson plus xPack (https://marketplace.visualstudio.com/items?itemName=ilg-vscode.xpack). I never regretted this choice. I have color output for builds and hyperlinked error and warning messages. For IntelliSense I use |
For the problems, you can add a The hyperlinking issue should also be addressed by configuring a problem matcher. Are you saying none of the "CMake: Clean" commands work when you use this setting? |
Yes: Specifically, when I click "Clean All Projects" it acts as if I had instead clicked "Build All Projects" (invokes cmake with target "Clean Rebuild All Projects" seems to work fine. |
I should mention that vscode developers have stated unequivocally that they will not add support for colors to the Output window, because reasons: microsoft/vscode#141556 (comment) They have directed people to file issues against extensions, so here we are. |
A potential workaround for this is using Use a
|
adding ...
"cmake.buildTask": true,
"cmake.environment": {
"CLICOLOR_FORCE": "1"
} to settings.json make it colorful |
this is really vscode's fault. they are clearly aware that people want ansci escape sequence support in the output tab. |
|
It seems the output channel can now be created with a language id, so that syntax gets highlighted; how about creating the channel with the |
I am genuinely puzzled. This issue is six years old. It exemplifies the principle that "there are no problems we can't create for ourselves." CMake Tools is an utterly useless extension. Guys, you are struggling with problems that wouldn't have existed in the first place if you hadn't used CMake Tools. All you need is a couple of lines in your |
Thanks a lot for this ^^, maybe the extension has some usefulness it is much more than syntax support and colored outputs ^^, CMake Tools currently improves the intellisense and debugging a lot ^^, it is not perfect, but better than nothing ^^, IBM's Colorized Output extensions improves the coloring situation a bit ^^ |
IntelliSense is from the CMake Language Support extension. It works perfectly without CMake Tools. You are right about debugging, though; I forgot that they added a CMake debugger to CMake Tools. It works with CMake 3.27 or newer. Besides this, everything can be achieved with the tools already present in VS Code. |
Great to know, VSCode isn't perfect and indeed tried to switch multiple times, I might try to make a better CMake C++ centered IDE soon, hopefully |
no need to set {"cmake.buildTask": true,} "editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope" : "markup.other.log.error",
"settings": { "foreground": "#FF0000" , "fontStyle": "italic" }
},
{
"scope" : "markup.other.log.warn",
"settings": { "foreground": "#F08000", "fontStyle": "italic" }
},
{
"scope" : "markup.other.log.info",
"settings": { "foreground": "#2cd3c5" }
},
{
"scope" : "markup.other.log.debug",
"settings": { "foreground": "#888585" }
},
{
"scope" : "markup.other.log.highlight",
"settings": { "foreground": "#19ff04" }
},
{
"scope" : "markup.other",
"settings": { "fontStyle": "italic" }
},
{
"scope" : "markup.italic",
"settings": { "fontStyle": "italic" }
}
]
}, |
thanks! |
For a CMake function template, I made a module/function to print colored messages. More information here: https://github.com/7R35C0/cmake-function-template.git |
Some updates on investigation I've done are located here #3683 |
Just refreshing here to remind of the context and learnings we made in #3683 |
still having this issue on vscode 1.93.1 with cmake 3.30.3 + cmake tool 1.19.52 |
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 text was updated successfully, but these errors were encountered: