https://bugs.kde.org/show_bug.cgi?id=465304

            Bug ID: 465304
           Summary: syntax highlighting for QML is broken when file starts
                    with shebang
    Classification: Frameworks and Libraries
           Product: frameworks-syntax-highlighting
           Version: 5.98.0
          Platform: Other
                OS: Other
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: syntax
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: kdeb...@toeai.com
                CC: walter.von.entfer...@posteo.net
  Target Milestone: ---

SUMMARY
Syntax highlighting for QML files is broken when the file includes shebang
line.

STEPS TO REPRODUCE
1. Open kate.
2. Make and save a QML file, e.g. "hello.qml":
import QtQuick 2
Rectangle {
    width: 200
    height: 100
    Text {
        text: "Hello, World!"
    }
}

3. Add a shebang line at the beginning of the file, e.g.
#!/usr/bin/env qml

OBSERVED RESULT
When you add the shebang, everything but the first two characters (or until a
/* multi-line comment */) turns orange (or green, in eariler versions.)

EXPECTED RESULT
Shebang should not break highlighting.

SOFTWARE/OS VERSIONS
Kubuntu 22.10
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6
Kate 22.08.2

ADDITIONAL INFORMATION
A commit related to Bug 325805 apparently fixed this for JavaScript in 2014. 
That commit also involved a minor change to qml.xml, however I don't think it
ever worked in QML.  Copying the lines related to shebang from javascript.xml
into qml.xml seems to make it correctly recognize the shebang line, except that
it doesn't color it like a comment, and I don't know enough about this syntax
highlighting system to know how to fix that.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to