-
Notifications
You must be signed in to change notification settings - Fork 79
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
Does not consistently style; dependent on the original line #287
Comments
I can't reproduce this, when you mean all on one line its something like this, right?: local foo = {
getTileProps = function(tile)
local result = {
adId = not GetFFlagLuaAppAddUniverseIdToGameImpressions() and (tile.props.entry and tile.props.entry.adId) or nil,
}
end,
} This immediately gets transformed into the 3 line formatting when I run it |
Yes, exactly.
gets formatted as
for me and another colleague. We're using 1.2.0 of StyLua, and using it through the VS Code extension and formatting on save. What's interesting is that if I hit save again, I'll get the 3 line version. I noticed the VS Code extension is a lot older than the binaries, so I tried downloading v0.10.1 binary (Windows won't let me get v0.11.0; it reports a virus) and calling it manually. It has the same issue, where if I run it manually with the file with all on one line, it gives me the 2 line version. But if I run it again, it doesn't change it. However, if I change the spacing a bit and run it, I'll get the 3 line version. Is it possible it's fixed in v0.11.0? |
I just tried it with But, if I add a few spaces in between Also, just to point out: The extension version (1.2.0) is independent from the binary version, and should normally automatically update to latest. You can also run the command |
Current master changes the behaviour though and now always formats these on 3 lines, so the inconsistency should no longer be an issue there. Technically, 2 lines is under the column width of 120, so latest should really be formatting it onto 2 lines. It doesn't really seem like a big issue for me though, so unless you think it should be on 2 lines I'll leave it for now. |
Actually, if I make the first function call slightly smaller, and do something like this: local foo = {
getTileProps = function(tile)
local result = {
adId = not GetFFlagLuaAppAddUniverseIdToGameImpress() and (tile.props.entry and tile.props.entry.adId)
or nil,
}
end,
} its gets formatted onto 3 lines, then second pass gets formatted onto 2. So this is still a valid bug. |
This code does not get consistently styled. Specifically, the "adId" line will just have the "or nil" on a second line if you have it all one line to start.
However, if you break up the "adId" statement first, and then style, you'll get 3 lines:
The text was updated successfully, but these errors were encountered: