Author Topic: Colored build output - a simple solution?  (Read 2005 times)

emmenlau

  • Junior Community Member
  • Posts: 9
  • Hero Points: 3
Colored build output - a simple solution?
« on: October 16, 2018, 03:33:04 PM »
I would like to have colored build output from gcc and/or clang in the build window (process buffer). I've seen various versions of this request in the forum already (i.e. https://community.slickedit.com/index.php/topic,7750.0.html). But sadly there is no simple solution. The suggestions typically involve associating the build buffer with a language and implementing a lexer for that language. I gave up on this after an hour of tests.

Why is this task so hard? It seems in 2018 people would expect this to "just work". At least with a bit of color highlighting, for example keywords like "warning" and "error". I would not mind configuring a working example. But starting from zero is way too complicated, the required steps deviate from post to post, and implementing a first lexer from scratch can take hours. This is quite a frustrating experience.

Could somebody share their lexer or show full complete screenshots of the required steps?

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Colored build output - a simple solution?
« Reply #1 on: October 16, 2018, 10:47:44 PM »
Can you explain how you want the output coloured with some examples?
If slick regular expressions can find errors and warnings then it's not hard to colourize I suspect - assuming the output buffer is a normal read / write buffer.

emmenlau

  • Junior Community Member
  • Posts: 9
  • Hero Points: 3
Re: Colored build output - a simple solution?
« Reply #2 on: October 17, 2018, 07:10:48 AM »
Dear @Graeme,
thanks for your reply. But I'm not sure what to do next.

I understand that for you its not hard to color the buffer. But for me it's hard. And I found at least the following other topics about this question, without a detailed solution:
  * https://community.slickedit.com/index.php?topic=408.0
  * https://community.slickedit.com/index.php?topic=15761.0
  * https://community.slickedit.com/index.php?topic=7750.0
  * https://community.slickedit.com/index.php?topic=14235.0

Can you explain step by step what would need to be done on a vanilla Slickedit install to get colored build output from gcc? I do not care what kind of colors or what kind of font, really! Maybe errors in red, warnings in orange and diagnostic gcc messages in green, but really I would not care. Just help me discriminate diagnostic messages from the standard build output. And please make this a default option for Slickedit.

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Colored build output - a simple solution?
« Reply #3 on: October 17, 2018, 11:05:44 AM »
Hi
I don't work for SlickEdit.  However, maybe this is not so easy, I will need some time to investigate.  I guess you know GCC can produce coloured output so it might make sense to use what GCC generates as suggested by Clark here (one of your links)
https://community.slickedit.com/index.php/topic,408.msg1615.html#msg1615

It looks like GCC lets you customize the colours
https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Message-Formatting-Options.html
and it looks like it is ANSI escape sequences e.g.
BRIGHT_RED "\x1b[0;1;31m"

Do you know if any of these escape sequences make it into the build window when you run GCC?  If so, can you copy and paste it to a file and post the file here.

In Slick C you can colour a line of text like this
Code: [Select]
      p_col = 1; _SetTextColor(CFG_FILENAME, _line_length(), false);
so the easiest way might be to write a macro that searches for errors etc and colours the whole line.  Can you capture a few lines or error and warning output from GCC and post it here?




emmenlau

  • Junior Community Member
  • Posts: 9
  • Hero Points: 3
Re: Colored build output - a simple solution?
« Reply #4 on: October 17, 2018, 11:31:36 AM »
Dear Graeme,
thanks a lot for your help again! I feel bad about my rant, and also feel bad for you to spend time on this. My frustration is that Slickedit makes a seemingly simple task too hard. I can not understand why this functionality is not part of the base package. I've tried CLion and other IDE's and this is one of the first things that "just work".

I've now also contacted Slickedit support with this question. I think this is such a broadly relevant question that there should be either a ready-made settings file for download, or a detailed PDF with the steps required, or this should be part of the core distribution. If you don't have something ready-made, please do not spend too much time on it!

Thanks a lot Graeme and all the best, Mario