kdl
kdl copied to clipboard
GitHub Syntax Highlighting
Would be nice to have GitHub identify and add syntax highlighting to KDL-formatted files
https://github.com/github/linguist
Will note that GitHub will likely not include a new grammar for a language unless it can be demonstrated that the language is in significant enough usage ("hundreds of repositories").
~However, including it will require a TextMate-compatible language definition (i.e. for TextMate, Sublime Text Editor, Atom). For example, the YAML syntax highlighting uses the Atom package. The production of such a package for KDL would be the biggest step towards enabling GitHub to start using it when usage of KDL is sufficiently large.~
See below comment re existing TextMate definition.
I think we have a TextMate definition here, but yes, as far as I am aware more usage is required for GitHub to consider adding it.
I think KDL does have enough usage now! 2.3k hits for searching for path:*.kdl
which is enough under the current rules. I am going through the steps to add a language but problems were found with the grammar (linked in the previous comment):
- Invalid regex in grammar:
source.kdl
(insyntaxes/kdl.tmLanguage.json
) contains a malformed regex (regex "(?![\\{\}<>;\[\]\=,\(\)\s])[\u00
...": PCRE does not support \L, \l, \N{name}, \U, or \u (at offset 29)) - Invalid regex in grammar:
source.kdl
(insyntaxes/kdl.tmLanguage.json
) contains a malformed regex (regex "(?![\\{\}<>;\[\]\=,\(\)\s])[\u00
...": PCRE does not support \L, \l, \N{name}, \U, or \u (at offset 29))
Any regex pros wanna jump in here? This sequence doesn't seem to be anywhere in the grammar.
I'm also not entirely sure what license the grammar is under. It needs to be one of these (see github-linguist/linguist/CONTRIBUTING.md#L125).
Maybe we can fix the grammar issues before 2.0? https://github.com/kdl-org/kdl/pull/285
@uncenter The grammar is under Apache-2.0 by virtue of being in the vscode-kdl repo.
And yes, it would be nice to fix the grammar issues before 2.0! Although the textmate grammar has to kinda be redone to support 2.0.
Oh it looks like the fixes already got merged.
Still, we should probably wait to pursue syntax highlighting until 2.0 is out.
as far as that sequence being present, it's in the regex for identifiers: https://github.com/kdl-org/vscode-kdl/blob/main/syntaxes/kdl.tmLanguage.json#L97
I'm not really sure how to work around this. KDL, and especially KDL 2.0, has specific restrictions around unicode codepoints. Does this mean that linguist's PCRE doesn't support unicode matching at all, or is there a different syntax I should be using?
oh maybe all that needs to be done is to use \x
instead of \u
🤔