SUMMARY The Kotlin syntax (the one used for highlighting, as opposed to the syntax of the actual language) is unnecessarily restrictive about where comments can be placed. For example, it will not recognize comments on import lines, in variable definitions (before the identifier), in class bodies (after the first member), STEPS TO REPRODUCE 1. Create or open a Kotlin file. 2. Place a comment in any of the locations described above. OBSERVED RESULT The comment is not highlighted as a comment. EXPECTED RESULT The comment should be highlighted as a comment. SOFTWARE/OS VERSIONS Linux/KDE Plasma: couldn't find, sorry KDE Plasma Version: 5.27.5 KDE Frameworks Version: 5.107.0 Qt Version: 5.15.10
Hi, Would be great if you could provide sample code that exhibits the issue along with a screenshot. That would make it easier for anyone wanting to work on this. Even better if you can fix this yourself and submit a patch. The syntax file for kotlin lives here https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/data/syntax/kotlin.xml. Checkout https://docs.kde.org/stable5/en/kate/katepart/highlight.html to know how to test the file and changes locally.
Created attachment 159846 [details] Sample code containing comments that aren't highlighted as comments
Created attachment 159847 [details] The sample code, as displayed in Kate.
I did try to fix this myself, and I found that documentation, but it was complex enough I had to give up. I suppose if nobody who knows the format better is around to do it, I can try again.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/501
Git commit 4c5d01c5937baa59c195ff61e1cec8b790adcff4 by Jonathan Poelen. Committed on 11/07/2023 at 22:13. Pushed by cullmann into branch 'master'. Kotlin: fix Comment and Annotation ; add keywords M +33 -0 autotests/folding/test.kt.fold M +33 -0 autotests/html/test.kt.dark.html M +33 -0 autotests/html/test.kt.html M +33 -0 autotests/input/test.kt M +33 -0 autotests/reference/test.kt.ref M +39 -6 data/syntax/kotlin.xml https://invent.kde.org/frameworks/syntax-highlighting/-/commit/4c5d01c5937baa59c195ff61e1cec8b790adcff4