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 Luau file type support #33767

Open
NeonD00m opened this issue Mar 2, 2025 · 6 comments
Open

Add Luau file type support #33767

NeonD00m opened this issue Mar 2, 2025 · 6 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first. type/upstream This is an issue in one of Gitea's dependencies and should be reported there

Comments

@NeonD00m
Copy link

NeonD00m commented Mar 2, 2025

Feature Description

Github supports Luau. github-linguist/linguist#6000

Screenshots

No response

@NeonD00m NeonD00m added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Mar 2, 2025
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 2, 2025

  • Luau "linguist" is detected by github.com/go-enry/go-enry/v2, it seems that it already supports "luau"

    • go-enry luau
  • Highlighting is powered by github.com/alecthomas/chroma/v2 , you could also use this approach: update the [highlight.mapping] section in your "app.ini", use Lua hightlighting

@wxiaoguang wxiaoguang added the type/upstream This is an issue in one of Gitea's dependencies and should be reported there label Mar 2, 2025
@silverwind
Copy link
Member

silverwind commented Mar 2, 2025

Is syntax the same as lua? If yes, just PR the file extension into chroma and it will automatically work in gitea:

https://github.com/alecthomas/chroma/blob/4b0882a15f49a23c272b79b5af541bf918b98998/lexers/embedded/lua.xml#L5-L6

Edit: According to this Linguist treats it as an alias to lua, so above is a good start:

https://github.com/github-linguist/linguist/pull/6612/files#diff-9c337ec09ccaaa1374713aad9ba26cdc1308586a27cb309a883a0b19bde663d8R3937-R3938

@silverwind
Copy link
Member

alecthomas/chroma#1056

@NeonD00m
Copy link
Author

NeonD00m commented Mar 5, 2025

It's not the same syntax as Lua. It's backwards compatible but there are substantial additions in syntax. See here: https://luau.org/

@wxiaoguang
Copy link
Contributor

For "highlighting", the syntax is more than 90% the same I guess, so I think at the moment it should be good enough to use "lua" syntax to highlight "luau" files.

@silverwind
Copy link
Member

silverwind commented Mar 6, 2025

It's not the same syntax as Lua. It's backwards compatible but there are substantial additions in syntax. See here: https://luau.org/

Right, but highlighting as lua is better than no highlighting imho. Also GitHub seems to highlight it as lua, at least in their CodeMirror, not sure about Prettylights but likely the same.

Also, monaco-editor does not support lual, and I can't even find an issue on https://github.com/microsoft/monaco-editor about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first. type/upstream This is an issue in one of Gitea's dependencies and should be reported there
Projects
None yet
Development

No branches or pull requests

3 participants