Community
Participate
Working Groups
Consider: #include "foo.h" #include <bar.h> Because #include is a recognized keyword, it is colorized in the editor. Because "foo.h" is tokenized as a string, it is colorized in the editor. Because <bar.h> is not a proper string, it is not colorized. It looks wrong, and encourages the user to use "dquotes" instead of <angles>. A mature software project would not want the editor to encourage one kind of include over another. (EMACS colorizes both "this" and <that>.)
Actually, this isn't a parser thing, this is an editor feature using simple rules for syntax colouring. I'll fire this over to Alain ... (for a change :-)
PR was targeted to the 2.0 release but not resolved, moving target to 2.1
I'm in the process of adding a new formatting style called "Header" to handle the angle brackets. From what I can see, the scanner isn't context sensitive (please correct me if I'm wrong) so '#include "foo.h"' would still be formatted as a C string.
I think that's true. The whole keyword highlight isn't very smart. That's probably why we haven't done angle brackets since it would be hard to tell that you don't accidentally color expressions with greater than or less than.
Created attachment 50820 [details] proposed patch from Jason Montojo (submitted on his behalf) Attaching a patch I received from Jason Montojo which I have applied to HEAD. This is not critical enough for 3.1.1 but I would like to apply this to 3.1.2 as soon as the branch is open for such contributions. As a result I'm targeting this to 3.1.2 and leaving the bug open.
Created attachment 50862 [details] Proposed patch (targeted for cdt_3_1)
I have just committed a rework of the preprocessor highlighting support to HEAD. Your patch is not lost of course, but incorporated into the rework. It is based on a new preprocessor partition so that it can be highlighted more finegrained. e.g. #include "..." is now colored the same as <...>, preprocessor directives have their own color key, instead of abusing the "built-in types" color key, etc. Please try it!
I'm marking this as FIXED.