stylua-action icon indicating copy to clipboard operation
stylua-action copied to clipboard

[Features] Allow running with --features lua52

Open SuperBo opened this issue 1 year ago • 2 comments

Hi @JohnnyMorganz, My code is currently use label feature of lua, however it is not enabled by default in release version.

Are there anyway for me to enable features like lua52 when running this action?

Thank you for your great Stylua and this github action.

SuperBo avatar Jun 01 '24 04:06 SuperBo

The release version does have lua52 enabled. What kind of error are you seeing?

You may be experiencing an issue similar to https://github.com/JohnnyMorganz/StyLua/pull/402 where Luau syntax clashes with Lua 5.2 syntax. You can use cargo to build a binary with only lua52 enabled and that should work. Hopefully in the next major release we will have runtime configurable syntax selection.

Unfortunately there is no way right now to use cargo within the stylua action, but doing cargo install stylua --features lua52 and running stylua via normal run steps should be fine

JohnnyMorganz avatar Jun 01 '24 11:06 JohnnyMorganz

@JohnnyMorganz, sorry for not mentioning the error. I met this https://github.com/JohnnyMorganz/StyLua/issues/407.

I managed to use cargo-instal action to install stylua instead.

SuperBo avatar Jun 01 '24 11:06 SuperBo

StyLua v2.0.0 now provides support for runtime syntax selection. You can configure this in either in the stylua.toml file, or on the command line with --syntax lua52.

JohnnyMorganz avatar Nov 18 '24 18:11 JohnnyMorganz

thank you for this feature @JohnnyMorganz <3

SuperBo avatar Nov 19 '24 01:11 SuperBo