-
Notifications
You must be signed in to change notification settings - Fork 72
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
Multiple runs with different output #261
Comments
Running into this issue where subsequent runs give different results, and it gets caught in a loop where it bounces back and forth between the two states, causing my Github Action check to always fail since StyLua always wants the other. State 0: local targetCash = { id = "Ben Franklin" }
local targetName = "StyLua_Bug"
local function findMoney()
for _, existingObject in pairs(workspace:GetChildren()) do
if
existingObject:GetAttribute("MoneyID") == targetCash.id
and existingObject.Name == targetName .. ".money"
then
break
end
end
end State 1: local targetCash = { id = "Ben Franklin" }
local targetName = "StyLua_Bug"
local function findMoney()
for _, existingObject in pairs(workspace:GetChildren()) do
if
existingObject:GetAttribute("MoneyID") == targetCash.id and existingObject.Name
== targetName .. ".money"
then
break
end
end
end If you take either of these and run StyLua, it will flip to the other. Running many times just flips back and forth, never ending. |
Seems to be the same (incorrect) formatting issue as #257, except in this case it's even worse as it keeps flipping between the two. In all these cases, I assume it's very near the column width boundary - this probably means we are incorrectly calculating the width budget available on a line somewhere, just need to find out where. |
We did not look at the RHS precedence level when determining to hang an expression. This led to assymetric formatting, which doesn't look as nice. This also led to an unstable formatting issue in #261
* Add unstable formatting test case * Fix unstable formatting of singleline table Caused by singleline table just hitting column width initially with no spaces between braces * Fix misformatting due to RHS binop precedence of expression We did not look at the RHS precedence level when determining to hang an expression. This led to assymetric formatting, which doesn't look as nice. This also led to an unstable formatting issue in #261
Running multiple times on the same file without otherwise changing the file sometimes yields different results.
Config at
/Users/tim/stylua.toml
:Lua file before (at `/Users/tim/example.lua):
First run:
Second run:
Expected:
The output of the second run should be the result after the first run, and subsequent runs should result in no changes.
The text was updated successfully, but these errors were encountered: