During Akademy there was finally enough time to finalize the porting of KTextEditor to KSyntaxHighlighting.
Thanks to the help of Dominik and Volker, the needed extensions to the KSyntaxHighlighting framework were done in no time ;=)
Thanks for that!
The branch for the integration was merged to master yesterday, unit tests look OK and I am using that state now for my normal coding work. Beside minor glitches that should now be corrected, no issues came up until now.
But as with all changes, for sure some regressions slipped in.
If you notice strange behavior of the highlighting in master, please report the issues on bugs.kde.org or on our mailing list (or even better: provide a fix on phabricator).
For sure there are potential further cleanups and now that we have only one implementation of the highlighting infrastructure, we will be able to move forward with extensions of it much easier.
We contacted the QtCreator people, to see if we might be able to share a common implementation, as they have an own one at the moment. Hopefully that works out in a nice way and our KDE syntax-highlighting framework gets an even broader user base!
Starting with the KDE Frameworks 5.50 release we decided to remove the capability in Kate/KTextEditor to download / update syntax highlighting files from the Kate homepage.
The reasons for this are as follows:
- The KTextEditor framework is released once a month, meaning that users who use latest KDE software usually anyways have the most recent versions. Other users who do not follow the latest development releases (like your mom) are likely not the target audience for downloading highlighting files.
- There are technical problems with only updating certain highlighting files, since it can lead to an inconsistent state when one highlighting file needs another one that was not updated or does not exist, or also if a highlighting file needs a certain indenter that does not yet exist or contains bugs.
- We have a nice small cleanup in the UI, since we have now one button less.
Contributing new Highlighting Files
By the way, we are always very happy to accept new highlighting files under MIT license. Documentation about how to write a syntax highlighting file can be found in the Kate Handbook. When you are done, please contribute your highlighting file in phabricator for the ‘syntax-highlighting’ framework (click Code Review, then on the very top right “Create Diff”). You can find nice instructions also on the Community wiki.
After fixing some first porting bugs to KSyntaxHighlighting, code folding (non-indentation based) is back working, too.
There is a still a lot to do (and e.g. the syntax colors are still kind of randomized), but already all KTextEditor original highlighting code is gone without ending up in an unusable state.
After several years, the time has come that KTextEditor finally starts to use more of KSyntaxHighlighting than just the syntax definitions resources.
At the moment, we still do everything on our own (parsing the xml, doing the highlighting, …) and only use the XML files bundled inside the KSyntaxHighlighting library as “code sharing”.
I started a “syntax-highlighting” branch in ktexteditor.git to change that. Dominik helped out by starting to add missing API to KSyntaxHighlighting that will ease the porting.
The first step will be: Having full working highlighting without color scheme or configuration support inside the branch.
If that is done, we will take a look at the scheme/configuration stuff.
The current state only handles the highlighting, folding is ATM out of order. It speaks for the quality of Volker’s KSyntaxHighlighting implementation that with minimal additions only 1-2 hours of work did lead to a “usable” result.
=> obligatory screenshot
Beside the missing folding markers, it doesn’t look that bad, or?
I hope we can work on that during Akademy, too, to finally move on and not keep all things duplicated just because we got no time to work on it.
Btw., thanks again to Volker for the work on the framework!