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.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/446
Git commit 8514122344088507ff18639ffbed2a947202a5b9 by Christoph Cullmann, on behalf of Jonathan Poelen. Committed on 06/02/2023 at 22:20. Pushed by cullmann into branch 'master'. QML: add shebang M +4 -4 data/syntax/latex.xml M +2 -2 data/syntax/markdown.xml M +10 -1 data/syntax/qml.xml https://invent.kde.org/frameworks/syntax-highlighting/commit/8514122344088507ff18639ffbed2a947202a5b9