-
Notifications
You must be signed in to change notification settings - Fork 76
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
Lua 5.2 label syntax error when using binary built all features enabled #407
Comments
I assume this is through downloading the binaries from GitHub releases? This is unfortunately because the binary is currently built with both Lua 5.2 and Luau parsing enabled, which causes this conflict. This was actually reported before too: #309 (comment) The only option right now is to install the binary using cargo |
Sure, I'll have to do some setup of cargo. I believe the output of this should probably be a feature request in being able to enable/disable these features at runtime for the ones that are installed, with the addition of having this error message (and others if they exist) to ask the user to provide the parser feature they intend to use. |
I definitely agree with having a runtime flag to do this, that is the ideal scenario. Unfortunately though the issue is upstream in our parser dependency, so it needs to be solved there |
Maybe in the meantime, could provide additional binaries in the GitHub releases with the respective features compiled into them individually, as well as the default one for all. There seems to be quite a lot that goes into installing Cargo on a system like Windows (in terms of dependencies) and I can imagine some developers would have already stopped trying at this point. Edit: |
I also agree on your second point, having Github release binaries for all possible flags would be good (#103). But as I mentioned in #309 (comment), right now there is potentially an issue with toolchain managers where they don't know which binary to install. I might test it out one release though, and publish all the binaries and see if anything breaks |
Given the latter (that these still error), we can't yet add this to pre-commit either. It seems there's no current way to get a reliable install for using stylua with neovim (especially via pre-commit) -- see JohnnyMorganz/StyLua#407 which basically says using --all-features is broken at the minute for labels, and requires specifically compiling only for 5.2. There doesn't seem to be a way to do this via the pre-commit install. The same seems true of Homebrew's stylua, which compiles with --all-features.
This syntax would otherwise not be legal when Luau parsing is enabled in stylua (which it is by default). JohnnyMorganz/StyLua#407
The next release of StyLua will give the ability to configure the syntax at runtime in your syntax = "Lua52" Or alternatively specify it on the command line, This should resolve this issue |
I was experimenting with using StyLua on minified Lua, and found that StyLua fails to parse this valid Lua when minified.
source:
-> minified:
with error:
If I add a semicolon after
local c = 1
in the minified Lua then it parses as expected.The text was updated successfully, but these errors were encountered: