Kampfkarren / selene

A blazing-fast modern Lua linter written in Rust
https://kampfkarren.github.io/selene/
Mozilla Public License 2.0
614 stars 78 forks source link

Support `goto` statements. #224

Open howmanysmall opened 3 years ago

howmanysmall commented 3 years ago

Currently Selene doesn't really like my usage of goto labels, as shown below. It'd be nice if it was supported. image

Kampfkarren commented 3 years ago

Relies on a full-moon update.

Kampfkarren commented 3 years ago

229 makes this possible, though a separate PR will need to turn on lua52 feature flag.

esatterwhite commented 1 year ago

@Kampfkarren I'm still getting this error on 0.24.0 w/ lua52 as a base. Is there something special that needs to be done to enable this support?

Kampfkarren commented 1 year ago

You need specifically a selene built with the lua52 feature flag. I'm not sure if that's available, or if that would even work.

Kampfkarren commented 1 year ago

It's more viable today than when this issue was first posted though

esatterwhite commented 1 year ago

I'd have to build one my self? do you have an example build command for this?

Kampfkarren commented 1 year ago

You would need to edit Cargo.toml in selene to include lua52 for full-moon

esatterwhite commented 1 year ago

ok. that seems to have worked. I'm not sure its entirely right.

# Cargo.toml

[workspace.dependencies]
full_moon = { version = "0.17.0", features = ["lua52"] }
#selene/Cargo.toml

[features]
default = [ "roblox", "lua52" ]
lua52 = []
tracy-profiling = ["profiling/profile-with-tracy","tracy-client"]
roblox = ["selene-lib/roblox", "full_moon/roblox", "ureq"]
Kampfkarren commented 1 year ago

That looks right to me, though we'd need a bit more work ourselves if we wanted to ship that.

esatterwhite commented 1 year ago

Is there any reason not to?

Kampfkarren commented 1 year ago

@JohnnyMorganz would be able to answer if the backwards incompatibilities with Lua 5.2 and Luau are problematic. There are more than zero. Ideally we want full-moon to be able to dynamically switch capabilities.

JohnnyMorganz commented 1 year ago

Yup, see https://github.com/JohnnyMorganz/StyLua/issues/407

chrisgrieser commented 1 year ago

any updates on this?

or any way to work with goto without having to build on your own, e.g. an ignore rule I may have missed in the docs?

Kampfkarren commented 1 year ago

Work is being done in the parser (https://github.com/Kampfkarren/full-moon) to be able to support swapping out languages easier, we can't really move forward on it until that's done. No ETA but it recently picked up more steam.

PMassicotte commented 9 months ago

Anyone have found a way to ignore goto parse_error?

I have tried to use this in my selene.toml without success.

std="lua52+vim"
Kampfkarren commented 9 months ago

This still needs a full-moon update, but everything is already merged into full-moon that makes this possible thankfully. ETA could be a week or so with dedicated effort.