kdl-org / kdl

the kdl document language specifications
https://kdl.dev
Other
1.14k stars 62 forks source link

GitHub Syntax Highlighting #82

Open miraclx opened 3 years ago

miraclx commented 3 years ago

Would be nice to have GitHub identify and add syntax highlighting to KDL-formatted files

https://github.com/github/linguist

shieldo commented 3 years ago

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.

larsgw commented 3 years ago

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.

uncenter commented 1 year ago

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):

Any regex pros wanna jump in here? This sequence doesn't seem to be anywhere in the grammar.

uncenter commented 1 year ago

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).

uncenter commented 1 year ago

Maybe we can fix the grammar issues before 2.0? https://github.com/kdl-org/kdl/pull/285

zkat commented 8 months ago

@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.

zkat commented 8 months ago

Oh it looks like the fixes already got merged.

Still, we should probably wait to pursue syntax highlighting until 2.0 is out.

zkat commented 8 months ago

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?

zkat commented 8 months ago

oh maybe all that needs to be done is to use \x instead of \u 🤔