Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add syntax highlighting for KDE/Kate #468

Closed
larsgw opened this issue Jan 8, 2025 · 5 comments
Closed

Add syntax highlighting for KDE/Kate #468

larsgw opened this issue Jan 8, 2025 · 5 comments
Assignees

Comments

@larsgw
Copy link
Contributor

larsgw commented Jan 8, 2025

I would like, at some point, to add syntax highlighting for KDE and the Kate editor. They use a custom XML-based format, so I doubt we can easily reuse existing syntax highlighters, though I don't exactly know which of those there are already.

Documentation: https://docs.kde.org/stable5/en/kate/katepart/highlight.html
Example syntax definition for TOML: https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/data/syntax/toml.xml

@larsgw larsgw self-assigned this Jan 8, 2025
@larsgw
Copy link
Contributor Author

larsgw commented Jan 20, 2025

Wow, a lot of this is really difficult, if not impossible. One essential feature for me is different colors for node names and property keys, but that pretty much impossible when considering multiline strings & comments.

@zkat
Copy link
Member

zkat commented Jan 20, 2025

@larsgw LSP supports semanticTokens, which lets you augment an editor's built-in, simplistic syntax highlighting with additional semantic stuff. KDL is such that you should be able to do all necessary highlighting purely with a static engine, but it's definitely harder to do some things depending on what you're using. tmLanguage sucks, for example.

@larsgw
Copy link
Contributor Author

larsgw commented Jan 21, 2025

Thanks for the info!

LSP supports semanticTokens, which lets you augment an editor's built-in, simplistic syntax highlighting with additional semantic stuff.

I don't know the extent of support for LSPs in Kate, and I'd like to at least provide some basic syntax highlighting without it. I think it could be shipped by default as well if it's included in https://invent.kde.org/frameworks/syntax-highlighting.

KDL is such that you should be able to do all necessary highlighting purely with a static engine, but it's definitely harder to do some things depending on what you're using. tmLanguage sucks, for example.

This one has look-aheads, but only using a RegExpr and while staying on the same line (which is an undocumented limitation). Regardless, RegExpr is insufficient for nested /**/ comments.

@larsgw
Copy link
Contributor Author

larsgw commented Jan 22, 2025

There we go: https://github.com/larsgw/katepart-kdl

@larsgw larsgw closed this as completed Jan 22, 2025
@zkat
Copy link
Member

zkat commented Jan 23, 2025

@larsgw make sure to add it to the README and kdl-org.github.io!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants