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. Syntax Highlighting "modifiers"
Forum Updated to NodeBB v4.3 + New Features

Syntax Highlighting "modifiers"

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 3 Posters 168 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.
  • G Offline
    G Offline
    Gregg
    wrote last edited by
    #1

    Hello all,

    I'm trying to setup Qt Creator for developing Zig code (i.e. the Zig programming language). As I understand it, the syntax highlighting information for Zig is provided by the KSyntaxHighlighting engine/project which is part of KDE. It works for the most part but two essential keywords 'const' and 'var' are not highlighted. Looking at the highlighting definition, they are listed as "modifiers".
    See https://invent.kde.org/frameworks/syntax-highlighting/-/blob/4e5d1a962459d3f69dc617f00edac1be044267e1/data/syntax/zig.xml#L92

    So my question is: Is there a way to setup Qt Creator (Edit -> Preferences -> Text Editor -> Font & Colors) such that the listed "modifiers" are highlighted?

    cristian-adamC 1 Reply Last reply
    0
    • G Gregg

      Hello all,

      I'm trying to setup Qt Creator for developing Zig code (i.e. the Zig programming language). As I understand it, the syntax highlighting information for Zig is provided by the KSyntaxHighlighting engine/project which is part of KDE. It works for the most part but two essential keywords 'const' and 'var' are not highlighted. Looking at the highlighting definition, they are listed as "modifiers".
      See https://invent.kde.org/frameworks/syntax-highlighting/-/blob/4e5d1a962459d3f69dc617f00edac1be044267e1/data/syntax/zig.xml#L92

      So my question is: Is there a way to setup Qt Creator (Edit -> Preferences -> Text Editor -> Font & Colors) such that the listed "modifiers" are highlighted?

      cristian-adamC Offline
      cristian-adamC Offline
      cristian-adam
      wrote last edited by
      #2

      @Gregg Qt Creator does fiddle a bit with the KSyntaxHighlighting information. It is not 1 to 1. See TextEditor::categoryForTextStyle for details.

      1 Reply Last reply
      2
      • S Offline
        S Offline
        SimonSchroeder
        wrote last edited by
        #3

        I'm no expert in this. But, it looks like "modifiers" are mapped to "attributes". Maybe there is a suitable setting for attributes in Qt Creators.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Gregg
          wrote last edited by
          #4

          @cristian-adam Thanks for the input. I've looked at the code of ksyntaxhighlighting, qt-creator and kate and and could not make much sense of it. Meaning I could not track down the place where "attributes" would be read or used from the zig.xml file.

          After trying out more color schemes in QT Creator again it seems like "modifiers" are mapped to "locals", which apparently comes from KSyntaxHighlighting::Theme::Variable, but I don't yet see the connection in the source.

          @SimonSchroeder Unfortunately that's not working for me. I'm on Qt Creator 17.0.1 and in the end it looks like "locals" is what I was looking for. Not sure how I missed that earlier and appreciate the input!

          1 Reply Last reply
          0
          • G Gregg has marked this topic as solved

          • Login

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