Bug 432976

Summary: Kate lacks Zig syntax highlighting and detects .zig files as C language, breaking LSP plugin
Product: [Frameworks and Libraries] frameworks-syntax-highlighting Reporter: nyanpasu64 <nyanpasu64>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: christoph, walter.von.entferndt
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description nyanpasu64 2021-02-15 16:40:41 UTC
SUMMARY
When I open a .zig file in Kate, it's detected as C language, causing the LSP plugin to launch clangd instead of zls.

STEPS TO REPRODUCE
1. Launch Kate and open a .zig file.
2. Optionally enable the "LSP Client" plugin, and open the "LSP Client" tool view and look at the Messages tab.

OBSERVED RESULT
Kate recognizes the Zig source code file as C. As a result, the LSP client launches clangd (which fails to parse the file, and gives inaccurate completions) instead of zls.

EXPECTED RESULT
Kate recognizes the Zig source file as Zig, applies Zig syntax highlighting, and launches zls (which the LSP client is already configured to do).

I don't know if it's intentional that Kate doesn't offer Zig highlighting and requires that you install it yourself. But it seems strange considering that Kate's LSP plugin offers a built-in rule (https://invent.kde.org/utilities/kate/-/merge_requests/117) to recognize Zig highlighting and run zls, yet Kate doesn't have a built-in Zig highlighting mode.

In the end, I installed https://github.com/ziglang/kde-syntax-highlighting (last updated 2018), which required `mkdir -p $HOME/.local/share/org.kde.syntax-highlighting/syntax/` since the folder didn't exist yet. After switching previously opened files from C to Zig highlighting mode, zls is called properly.

Operating System: Garuda Linux
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.79.0
Qt Version: 5.15.2
Kernel Version: 5.10.15-120-tkg-bmq
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-6200U CPU @ 2.30GHz
Memory: 7.6 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 520

ADDITIONAL INFORMATION
Comment 1 Christoph Cullmann 2021-02-15 17:51:51 UTC
We had a merge request but it never landed.

If you get the author to relicense under MIT (or under the license he based that work on), we can try to merge this.

See last try

https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/98
Comment 2 Christoph Cullmann 2022-08-23 21:06:02 UTC
Hi,

as long as nobody contributes a highlighting, nothing will happen.

We have good documentation on

https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/README.md

to get somebody started. Beside this, one can always reach out on the channels described on

https://kate-editor.org/support/