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

Long function with multiple generic return types formats inconsistently #896

Open
Great-Bird opened this issue Sep 27, 2024 · 0 comments · May be fixed by #919
Open

Long function with multiple generic return types formats inconsistently #896

Great-Bird opened this issue Sep 27, 2024 · 0 comments · May be fixed by #919
Labels
enhancement New feature or request luau Formatting related to Luau

Comments

@Great-Bird
Copy link

A column width-exceeding function definition with multiple return types with generics collapses over one of the type parameters instead of placing each return type on a new line.

Before and after:

-- before
local function getData(player: Player): (LongReturnValueWithTypeGeneric1<TypeParameter1>, LongReturnValueWithTypeGeneric2<TypeParameter2>) end

-- after
local function getData(player: Player): (LongReturnValueWithTypeGeneric1<TypeParameter1>, LongReturnValueWithTypeGeneric2<
	TypeParameter2
>) end

-- expected
local function getData(player: Player): (
	LongReturnValueWithTypeGeneric1<TypeParameter1>,
	LongReturnValueWithTypeGeneric2<TypeParameter2>
) end

Example of expected output working for a similar example:

-- before
local function getData(player: Player): (LongReturnValueNameWithoutTypeGeneric1, LongReturnValueNameWithoutTypeGeneric2, LongReturnValueNameWithoutTypeGeneric3) end

-- after & expected
local function getData(player: Player): (
	LongReturnValueNameWithoutTypeGeneric1,
	LongReturnValueNameWithoutTypeGeneric2,
	LongReturnValueNameWithoutTypeGeneric3
) end

stylua.toml:

column_width = 120
line_endings = "Windows"
indent_type = "Tabs"
indent_width = 4
quote_style = "AutoPreferDouble"
call_parentheses = "NoSingleTable"
collapse_simple_statement = "Never"

[sort_requires]
enabled = true
@JohnnyMorganz JohnnyMorganz added the enhancement New feature or request label Oct 3, 2024
@JohnnyMorganz JohnnyMorganz added the luau Formatting related to Luau label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request luau Formatting related to Luau
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants