qt creator: issue with syntax highlighting
-
Hi, I've found some problem. There's no code highlighting under preprocessor definition, even if definition is true.
Look screenshot 1 before and screenshot 2 after.
Definitions which are false are just grey.
How to correct that? Thanks.
-
Hi,
Do you mean no highlighting when you put the define in comment ?
-
@SGaist Hi. No, I mean almost no highlighting inside definition body like on screenshot 1. But if I comment definition everything is becoming normal like on screenshot 2.
#define FOO /* <- in myproject.config file */
#ifdef FOO /* some code here */ // <- no highlighting #endif
//#ifdef FOO /* some code here */ // <- highlighting is OK #endif
I have a feeling that it probably somehow connected to my previous highlighting configurations.
Also if #define FOO is located in source file everything is fine, but I'm using it as a global definition, so I put it in myproject.config file. -
Indeed, at some point, if Qt Creator can't determine that FOO is defined, it can't do the highlighting as you would like.
-
@SGaist The problem that it's determining that FOO is defined, otherwise he would show all text inside definition as grey (or cut out), issue is happening if definition is defined in myproject.config file. Probably it just a bug and nothing can be done here.
-
Just to be sure I understand you correctly: you only have FOO defined in your myproject.config file but Qt Creator detects that and thus does the highlighting ?
-
@SGaist Yes, qt creator see definitions in myproject.config but for some reason it doesn't do a highlighting inside definitions condition.
normal case:
file main.c#define FOO #ifdef FOO /* highlighting is OK here */ #endif
my case:
file myconfig.config#define FOO
file main.c
#ifdef FOO /* highlighting is NOT OK here, but it is active otherwise code would be grey */ #endif
another case:
file myconfig.config//#define FOO /*<- definition is removed in config file*/
file main.c
#ifdef FOO /* code is totally grey and cut, because QtCreator doesn't see FOO any more */ #endif
-
I'm really not sure Qt Creator's highlighting can take into account a define that come from an outside file like that one.
-
I do understand the idea. You should contact the Qt Creator devs to see if this use case is already supported. You can to that either through IRC or the Qt Creator mailing list