Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: eaglecode on August 30, 2017, 10:26:17 am

Title: highlight/colorize embedded code
Post by: eaglecode 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!
Title: Re: highlight/colorize embedded code
Post by: BlueHazzard 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.
Title: Re: highlight/colorize embedded code
Post by: oBFusCATed 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.