Skip to content

Long function with multiple generic return types formats inconsistently #896

Open

Description

@Great-Bird

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

Activity

  1. added
    enhancement
    on Oct 3, 2024
  2. added
    luau
    on Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementluau

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions