Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. qt creator: issue with syntax highlighting
QtWS25 Last Chance

qt creator: issue with syntax highlighting

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
10 Posts 2 Posters 4.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CybGen
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean no highlighting when you put the define in comment ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      C 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Do you mean no highlighting when you put the define in comment ?

        C Offline
        C Offline
        CybGen
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Indeed, at some point, if Qt Creator can't determine that FOO is defined, it can't do the highlighting as you would like.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          C 1 Reply Last reply
          0
          • SGaistS SGaist

            Indeed, at some point, if Qt Creator can't determine that FOO is defined, it can't do the highlighting as you would like.

            C Offline
            C Offline
            CybGen
            wrote on last edited by
            #5

            @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.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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 ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              C 1 Reply Last reply
              0
              • SGaistS SGaist

                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 ?

                C Offline
                C Offline
                CybGen
                wrote on last edited by
                #7

                @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
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  I'm really not sure Qt Creator's highlighting can take into account a define that come from an outside file like that one.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  C 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    I'm really not sure Qt Creator's highlighting can take into account a define that come from an outside file like that one.

                    C Offline
                    C Offline
                    CybGen
                    wrote on last edited by
                    #9

                    @SGaist Oh well, this is the whole sense of myproject.config file

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      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

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved