Extending QtCreator's Syntax Highlighting with a Plugin



  • Is it possible to extend the Syntax Highlighting and Intellisense in QtCreator to accept QML Extensions through Plugins?

    For example, I create a plugin that registers a new Component Type: Cat. Cat has the property legs.

    @
    Item {
    Cat {
    id: ilean
    legs: 2
    }
    }
    @

    Cat will be underlined in Red showing the IDE developer that Cat is illegal. And intellisense will not pick up legs as an accepted property.

    Is it currently possible to extend the syntax definitions?



  • Hi,

    I believe the information comes from the xml files in the qml-type-descriptions folder (in the creator source tree located at src/share/qtcreator/qml-type-descriptions), which are generated using the qmldump tool (src/tools/qml/qmldump). You could try generating a similar file for your plugin.

    Michael



  • Perfect! Thanks!


  • Moderators

    Have you tried using a snapshot of Qt Creator? The QML handling has seen much work, maybe that already works there already (I think it does, but I am not 100% sure).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.