rhaiscript / rhai

Rhai - An embedded scripting language for Rust.
https://crates.io/crates/rhai
Apache License 2.0
3.74k stars 177 forks source link

Consider adding to github/linguist #537

Open Purpzie opened 2 years ago

Purpzie commented 2 years ago

I noticed that .rhai files don't have any highlighting on github, and that no issues exist about this yet. Github's highlighting is powered by github/linguist, and they allow people to submit new languages if they're popular enough (used in >200 repos). Unfortunately github's search is pretty broken atm so I'm not sure how many repositories rhai is in.

Until github supports it, throwing this in a repo's .gitattributes will highlight it by pretending it's rust:

*.rhai linguist-language=Rust
schungx commented 2 years ago

Rhai is a scripting language, so I'm not sure if it is actually used in any repo as a main development language.

However, I'll try the .gitattributes trick.

It might be better to use js in order to get support for interpolated strings...

Purpzie commented 2 years ago

True, but other scripting languages are already highlighted, such as lua.

Also oops yeah almost forgot about interpolated strings. I chose rust because I figured js would freak out without () in if statements.

schungx commented 2 years ago

Also oops yeah almost forgot about interpolated strings. I chose rust because I figured js would freak out without () in if statements.

It actually does OK with if... I tried JavaScript on my own repo and it seems to work fine!

Rust seems to mainly trip on interpolated strings, switch statements, import and export statements etc.

Sable-20 commented 2 years ago

https://github.com/search?l=&q=a+extension%3Arhai&type=code

dunno if this is what youre looking for but here you go @Purpzie search for repos using rhai

emesare commented 2 years ago

Now that GitHub support cargo dependencies, there is quite a few codebases that support rhai scripts! https://github.com/rhaiscript/rhai/network/dependents

schungx commented 2 years ago

I tried to submit to github/linguist quite a while ago but for some reason which I cannot remember I couldn't.

Maybe somebody can help do that?