Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Behind the Scenes
  3. Qt.io webservices
  4. Improving syntax highlighting for QML
Forum Updated to NodeBB v4.3 + New Features

Improving syntax highlighting for QML

Scheduled Pinned Locked Moved Qt.io webservices
14 Posts 5 Posters 5.7k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    frankcyblogic.de
    wrote on 7 Apr 2011, 12:41 last edited by
    #1

    I would like to improve the syntax highlighting. Especially make it support QML and Javascript, better.
    Is something like this already planned? Where do I start?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on 7 Apr 2011, 12:46 last edited by
      #2

      You mean syntax highlighting for QML here on the forum? That would be nice.

      Ask for it using a feature request on "Jira":http://bugreports.qt.nokia.com.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        frankcyblogic.de
        wrote on 7 Apr 2011, 12:56 last edited by
        #3

        I don't have much patience and I really know what I'm doing when it comes to lexical parsing. So which format is needed? I can write the regex right away.

        The devnet is using "this highlighter":http://alexgorbatchev.com/SyntaxHighlighter/ ?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mgran
          wrote on 7 Apr 2011, 13:57 last edited by
          #4

          [quote author="unclewerner" date="1302181004"]The devnet is using "this highlighter":http://alexgorbatchev.com/SyntaxHighlighter/ ?[/quote]

          Yes, that is correct. Our version is plain vanilla, no custom hacks.

          Project Manager - Qt Development Frameworks

          1 Reply Last reply
          0
          • F Offline
            F Offline
            frankcyblogic.de
            wrote on 7 Apr 2011, 14:13 last edited by
            #5

            Thanks for the info! I will see then if I can fix the highlighter.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mgran
              wrote on 7 Apr 2011, 14:37 last edited by
              #6

              [quote author="unclewerner" date="1302185614"]Thanks for the info! I will see then if I can fix the highlighter.[/quote]

              That would be awesome unclewerner, I can offer you 400 all virtual devnet points as a bounty for your effort if you share it with us and Alex Gorbatchev :)

              Project Manager - Qt Development Frameworks

              1 Reply Last reply
              0
              • T Offline
                T Offline
                troubalex
                wrote on 7 Apr 2011, 14:55 last edited by
                #7

                [quote author="mariusg" date="1302187062"]
                That would be awesome unclewerner, I can offer you 400 all virtual devnet points as a bounty for your effort if you share it with us and Alex Gorbatchev :)[/quote]

                Approved. ;)

                THE CAKE IS A LIE
                Web Community Manager - Qt Development Frameworks

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  frankcyblogic.de
                  wrote on 8 Apr 2011, 12:04 last edited by
                  #8

                  I looked again into the highlighter. For starters it would be nice to select the "brush". JavaScript is already there, but cannot be selected (or at least I don't know how). When I look at the HTML code generated by the wiki, everything seems to be highlighted using the C++ brush by default. Maybe allow selection of "c++", "js", "python" and "qml" somehow? QML could be mapped to css for starters, the others are already supported by the highlighter.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mgran
                    wrote on 8 Apr 2011, 12:23 last edited by
                    #9

                    Since we have a single code tag (@) we have used the C++ as a base and added Qt classes on our own. Our goal is to make it simple, hence only one code tag.

                    We are cool with setting the syntax highlight standard much lower than in an IDE, since this is just a web page after all. It simply needs to give the viewer the overview of the code snippet, not the IDE use-cases of syntax highlighting.

                    We have been pondering on making Qt classes auto-link to the relevant page in documentation though...

                    Project Manager - Qt Development Frameworks

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      frankcyblogic.de
                      wrote on 8 Apr 2011, 12:30 last edited by
                      #10

                      I see. But it looks quite uggly because JavaScript has different keywords. I would really like to see an option to select the language.

                      Maybe like this:
                      @
                      [[code:qml]]
                      %
                      MyComponent {
                      id: smth
                      width: other.width * 2
                      }
                      %
                      @

                      It's OK to have the Qt class name hacks with all the languages.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mgran
                        wrote on 8 Apr 2011, 12:39 last edited by
                        #11

                        The @ tag can only take one brush, to add additional tags for syntax highlighting is not something we can do quickly. We have some experimental work on [ code ] (without the spaces, try it) and I guess this can fit the bill, but it's not ready yet. Then we could have [code brush=js] (with "qml" and "quick" as aliases for "js").

                        Edit: or [code:qml] as suggested in your edit :)

                        Project Manager - Qt Development Frameworks

                        1 Reply Last reply
                        0
                        • F Offline
                          F Offline
                          frankcyblogic.de
                          wrote on 8 Apr 2011, 13:06 last edited by
                          #12

                          OK, let's see...

                          [code]
                          var f = function() { return 0; }, s = "abc\n" // comment

                          Qt.point(0.,0.)

                          MyComponent {
                          id: smth
                          width: 2 * other.width
                          }
                          [/code]

                          Looks like a generic highlighter. Nice.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            mgran
                            wrote on 8 Apr 2011, 13:07 last edited by
                            #13

                            As you can see, it's a tad broken :)

                            Project Manager - Qt Development Frameworks

                            1 Reply Last reply
                            0
                            • Z Offline
                              Z Offline
                              ZapB
                              wrote on 9 Apr 2011, 08:17 last edited by
                              #14

                              [quote author="mariusg" date="1302265389"]
                              We have been pondering on making Qt classes auto-link to the relevant page in documentation though...[/quote]

                              I was wondering if this would be possible. It would be especially cool to have once the docs come under QtDN too.

                              Nokia Certified Qt Specialist
                              Interested in hearing about Qt related work

                              1 Reply Last reply
                              0

                              2/14

                              7 Apr 2011, 12:46

                              topic:navigator.unread, 12
                              • Login

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