Quick-Turn-Studio / CLionSupportForQt

19 stars 0 forks source link

File parsing fails if directory import contains underscore #33

Closed M4rtinK closed 3 years ago

M4rtinK commented 3 years ago

If there is an underscore in directory import path, the parsing will fail, breaking syntax highlighting for the full file.

import "foo_component" fails to parse, resulting in:

QmlTokenType.FOLDER_PACKAGE_NAME or QmlTokenType.PACKAGE_NAME expected, got '"'

Dropping the underscore fixes the parsing:

import "foocomponent"

Full reproducer follows:

main.qml

import QtQuick 2.3
import QtQuick.Window 2.0
import "foo_component"

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World") //The method qsTr() is used for translations from one language to other.
    FooRectangle {
        width : 300
        height : 300
        anchors.centerIn: parent
    }
    Text {
        text: qsTr("Hello World")
        anchors.centerIn: parent
    }
}

foo_component/FooRectangle.qml


import QtQuick 2.0

Rectangle {
    id : br
    color : "red"
}
grabusr commented 3 years ago

Hi Martin

Version 0.9.6 is ready to download. Please let us know if it solves your problem with comments.