Skip to content
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

It requires 2 runs of Stylua so stabilize the output for some examples #430

Closed
ktrz opened this issue Apr 1, 2022 · 1 comment
Closed
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@ktrz
Copy link
Contributor

ktrz commented Apr 1, 2022

All of the examples are run wth the following configuration:

StyLua version: 13.0.0

.stylua.toml file:

column_width = 100
line_endings = "unix"
indent_type = "T=tabs"
indent_width = 4
quote_style = "double"

The following examples require 2 runs of StyLua to produce proper (and stable) results

type Foo<T = --[[leading]]
string
--[[trailing]]> = { baz: T, }
type Bar<T
--[[ Trailing comment ]]> = {}
-- This is a comment before
type Foo = --[[ Comment before Bar ]]
Bar<--[[ Before X ]]
X, --[[ After X ]]
--[[ Before Y ]]
Y, --[[ After Y ]]
--[[ Before Z ]]
Z
--[[ After Z ]]> -- This is a comment after
type OffsetEnum = { [string]: number, }
local OffsetEnum = {aValue = 10, anotherValue = 11, yetAnotherValue = 12, reset = 0, postReset = 1}

Results after the first run

type Foo<
	T =  --[[leading]]string	--[[trailing]]

> = { baz: T }

----------------

type Bar<T--[[ Trailing comment ]]
> = {}

-----------------

-- This is a comment before
type Foo =  --[[ Comment before Bar ]]Bar<--[[ Before X ]]X,  --[[ After X ]]--[[ Before Y ]]
Y,  --[[ After Y ]]--[[ Before Z ]]
Z--[[ After Z ]]
> -- This is a comment after

-------------------

type OffsetEnum = { [string]: number }
local OffsetEnum =
	{
		aValue = 10,
		anotherValue = 11,
		yetAnotherValue = 12,
		reset = 0,
		postReset = 1,
	}

Results after the second and any consecutive run

type Foo<
	T =  --[[leading]]string --[[trailing]]
> = { baz: T }

----------------

type Bar<
	T--[[ Trailing comment ]]
> = {}

-----------------

-- This is a comment before
type Foo =  --[[ Comment before Bar ]]Bar<--[[ Before X ]]X,  --[[ After X ]]--[[ Before Y ]]Y,  --[[ After Y ]]--[[ Before Z ]]Z--[[ After Z ]]> -- This is a comment after

-------------------

type OffsetEnum = { [string]: number }
local OffsetEnum = {
	aValue = 10,
	anotherValue = 11,
	yetAnotherValue = 12,
	reset = 0,
	postReset = 1,
}
@JohnnyMorganz JohnnyMorganz added the bug Something isn't working label Apr 1, 2022
@JohnnyMorganz
Copy link
Owner

This looks like a duplicate of #397, but with some more good test cases to use. I'll move it over there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants