Bug 429539

Summary: Allowing mixing syntax highlights
Product: [Applications] kate Reporter: Marcos Dione <mdione>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: wishlist CC: christoph, mdione
Priority: LO    
Version First Reported In: 20.08.2   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Marcos Dione 2020-11-23 10:29:10 UTC
It is not uncommon to have a mix of languages on the same source:

* salt and ansible use jinja for templating configuration files; salt even mixes jinja and yaml.
* php sources can have HTML, JS and even SQL (4 languages!) in the same source.
* etc.

Kate only allows one syntax highlighting (SHL) at a time, rendering part of the code as plain text or worse. It would be nice if SHLs could be combined in the same view. For templating languages like jinja, it seems easy(er); PHP should definitely be harder (specially detecting SQL queries).
Comment 1 Christoph Cullmann 2020-12-12 14:58:56 UTC
We already support mixing, but that must be done in the individual syntax definition files. You can reference there other highlightings for parts of a document.

If you want to improve on this for some languages, please provide some patch to

https://invent.kde.org/frameworks/syntax-highlighting
Comment 2 Marcos Dione 2020-12-14 07:52:09 UTC
Perfect. I will try to do that for YAML based .sls files (Salt). The only remaining question: what the best way to force kate to reread the syntax files? and is there a way to debug them somehow? Cheers!