Author Topic: highlight/colorize embedded code  (Read 2285 times)

Offline eaglecode

  • Single posting newcomer
  • *
  • Posts: 2
highlight/colorize embedded code
« on: August 30, 2017, 10:26:17 am »
Hi all!

I'm coding C/C++ with codeblocks for some years now, but with growing code I'am missing the possibility to highlight embedded code.

In this case I have embedded SQL strings in the code and for copy and paste reasons I have enclosed them into a MULTI_LINE_STRING() define.

Code
bool sqladapter::get_cars(session& sql)
{
  sql << MULTI_LINE_SQL(
    SELECT * FROM cars;
  );
}

My target is now to highlight everything between the brackets (the SQL code), maybe with a different background color or something similar.
I've seen and tested the scintilla highlight options, having matching brackets in every color I like, I have highlighted the "MULTI_LINE_SQL" keyword, but what about the part between the brackets ??? ?

Any ideas (or is it so simple, that I've missed it) ?

Thanks in advance!

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: highlight/colorize embedded code
« Reply #1 on: August 30, 2017, 12:09:31 pm »
i am afraid, but i think without modifying the codeblocks source this won't be possible... Codeblocks uses the scintilla lexer interface so you can look at their site how to do tings.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: highlight/colorize embedded code
« Reply #2 on: August 30, 2017, 09:19:06 pm »
Your only option is to modify the c/c++ lexer in scintilla or you could probably implement a plugin that overrides the styling of parts of the text, but I'm not sure how it could be done. But for sure you'll need to write some custom code that modifies or extends codeblocks.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]