KTextEditor depends on KSyntaxHighlighting

Recently, the KSyntaxHighlighting framework was added to the KDE Frameworks 5.29 release. And starting with KDE Frameworks 5.29, KTextEditor depends on KSyntaxHighlighting. This also means that KTextEditor now queries KSyntaxHighlighting for available xml highlighting files. As such, the location for syntax highlighting files changed from $HOME/.local/share/katepart5/syntax to


So if you want to add your own syntax highlighting files to Kate/KDevelop, then you have to use the new location.

By the way, in former times, all syntax highlighting files were located somewhere in /usr/share/. However, since some time, there are no xml highlighting files anymore, since all xml files are compiled into the KSyntaxHighlighting library by default. This leads to much faster startup times for KTextEditor-based applications.

Running Unit Tests

If you build Kate (or KTextEditor, or KSyntaxHighlighting) from sources and run the unit tests (`make test`), then the location typically is /$HOME/.qttest/share/org.kde.syntax-highlighting/syntax.

11 thoughts on “KTextEditor depends on KSyntaxHighlighting”

  1. That’s the second time the path’s changed in a few years, last time it caused some confusion, several forum threads and a couple of bug reports.

    I take it the previous path is (again) ignored; is there any reason not to keep checking the old location when the syntax hasn’t changed?

  2. Never mind, I see the old path actually was included as a fallback this time.

    // backward compatibility with Kate
    dirs=QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral(“katepart5/syntax”), QStandardPaths::LocateDirectory);

  3. Opensuse Tumbleweed – About Kate shows KDE Frameworks 5.32.0 and ~/.local/share/katepart5/ still works. All updated xml HL files appear there. System-wide they are still in /usr/share/kde4/apps/katepart/syntax/*.xml. This is 5.9.4 plasma. I created the org.kde…dir mentioned above and moved my own xml files and that location works too. Although the first time I got an error, but restarted and all ok. I tried to recreate by deleting ~/.config/katesyntaxhighlightingrc, etc but couldn’t.
    1. Are these instructions still valid:
    2. What’s the kde5 equivalent to: kde4-config? (A little pgm to output installation paths)
    3. kcmshell5 –version shows the plasma version from the command line, is there one for the framework?
    4. Are blank lines still ignored:
    5. How do I turn off Mini Maps in 5? On 4, it is under View.

  4. Don’t know if this is the place to ask. If not, please point me to the right place.
    My syntax definition worked fine before updating kate today (as part of the Ubuntu 17.04 update). I have moved my script to the new location, and deleted the old ones. But it does not turn up in Kate. I have validated it with validate.sh (which did throw an error about the language.xsd, then didn’t (thats when I validated), and now does again…).
    Anyone who could give me a hint about what to do?
    Just to make sure I used the right folder, I changed a single line in a script already there, and that was visible when opening Kate again…

  5. Kate told me the error when opening from terminal: I used a wrong version number: 16.12 (thought I should give the version of Kate – don’t know why that wasn’t the case). I changed to 2.5, and now it works.
    Sorry for disturbing.

  6. After upgrading to Kubuntu 17.04 my Smarty template syntax highlighting quit working. It worked well for years. I’ve copied the file to every location there is, it does not post an error, but still refuses to work. The “Smarty” filetype does not show up in the list of filetypes either. Nothing i do will make this work. Any suggestions would be very much appreciated. I’m using the file at https://github.com/mtorromeo/kate-syntax-files/blob/master/smarty.xml

    1. Change version=”1.0″ to version=”2″. We changed to only allow integer versions. Think of revisions 🙂 this should work. Besides that, does kate not have smarty highlighting? If not, do you want to contribute your file?

Leave a Reply