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

Function calls break into multiple lines after 17 string concatenations #432

Closed
dhruvmanila opened this issue Apr 1, 2022 · 1 comment · Fixed by #434
Closed

Function calls break into multiple lines after 17 string concatenations #432

dhruvmanila opened this issue Apr 1, 2022 · 1 comment · Fixed by #434
Labels
bug Something isn't working

Comments

@dhruvmanila
Copy link

.stylua.toml:

column_width = 80
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferSingle"
call_parentheses = "None"

Example code:

local function foo(...) end
local function long_function_name() end

local function test()
  return 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. foo(long_function_name())
end

In the above example, concatenate another 'test' and run the formatter. It will break the function call as:

local function foo(...) end
local function long_function_name() end

local function test()
  return 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. 'test'
    .. foo(
      long_function_name()
    )
end

I don't know if it's a bug or not, but this seems like a weird edge case.

@JohnnyMorganz
Copy link
Owner

Yep, looks like a bug. We probably aren't resetting the shape properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants