Tree-sitter: Options for GitHub syntax highlighting?

Created on 18 Dec 2019  路  5Comments  路  Source: tree-sitter/tree-sitter

Are there any options for syntax highlighting code on GitHub with tree-sitter? Perhaps a Chrome plugin that does client side rendering? This would be a game changer.

Also, are you aware of any plans/progress on proper VSCode integration (not a third-party plugin)? Alas, most folks use VSCode instead of Atom today.

feature_request

All 5 comments

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.67. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

I don鈥檛 have any insider knowledge on the VSCode side, but I may have a good option on the GitHub.com side very soon; stay tuned.

That's great to hear! I'm especially interested in an option that enables tree-sitter based syntax highlighting without being accepted into linguist or a similar public repo, as that's a very high bar and not an option for proprietary file formats/languages.

I guess https://github.com/microsoft/vscode/issues/585 which was tested in https://github.com/microsoft/vscode/issues/85976 would technically allow this, but I'm not sure if it will allow to get rid of the textmate grammar completely. I hope it will.

@fcurts Ah, thanks for the explanation. A browser extension to allow custom highlighting could be very cool. I think that specific application is not something that I personally can help with very much. But what I would like to do is make the syntax highlighting algorithm itself usable by you, if you were to implement such a thing.

The current best syntax highlighting algorithm based on Tree-sitter is implemented in this repo in the highlight directory. It has both a Rust API and a plain C API. At GitHub, we are now using this to highlight several languages. I plan on writing up more detailed documentation for this soon.

Alternatively, the Tree-sitter WASM binding has all of the same core functionality, but does not provide an actual syntax highlighting implementation. If someone is interested in adding that to the library, or developing that as a separate JavaScript libarary, I could provide some support and guidance, but won't be working on that problem myself.

I think we should close this out, as the specific feature request is a bit out of scope for this project, but feel free to open further issues about any specific problems you come across in pursuing this syntax-highlighting project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

calixteman picture calixteman  路  4Comments

fwcd picture fwcd  路  6Comments

ubolonton picture ubolonton  路  3Comments

worudso picture worudso  路  4Comments

wongjiahau picture wongjiahau  路  6Comments