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

gleam format breaks up function call strangely when close to line length #2496

Closed
rawhat opened this issue Dec 28, 2023 · 2 comments · Fixed by #2513
Closed

gleam format breaks up function call strangely when close to line length #2496

rawhat opened this issue Dec 28, 2023 · 2 comments · Fixed by #2513
Labels
bug Something isn't working priority:high

Comments

@rawhat
Copy link
Contributor

rawhat commented Dec 28, 2023

Hello! Tagging @giacomocavalieri as discussed in the Discord.

The line is formatted like this:

let assert Ok(new_stream) =
  stream.new(identifier, settings.initial_window_size, handler, conn,
  )

It seems like this should either put the closed paren on the same line, or just break out the arguments into separate lines. The latter is what happens when I make one of the variable names longer.

Thank you!

@lpil
Copy link
Member

lpil commented Dec 30, 2023

Oh yes, this is a bug. Thank you

@giacomocavalieri can you help with this one? No rush but your context is best!

@lpil lpil added bug Something isn't working priority:high labels Dec 30, 2023
@giacomocavalieri
Copy link
Member

giacomocavalieri commented Dec 31, 2023

Working on it! I have a simpler example that gets formatted badly:

pub fn main() {
  function_call(that, is, super, close, to, the, max, line, limit, of, 80, chars,
  )
}

Since the call is 81 chars long it should actually be formatted as:

pub fn main() {
  function_call(
    that,
    is,
    super,
    close,
    to,
    the,
    max,
    line,
    limit,
    of,
    80,
    chars,
  )
}

giacomocavalieri added a commit to giacomocavalieri/gleam that referenced this issue Dec 31, 2023
@lpil lpil closed this as completed in #2513 Jan 4, 2024
lpil pushed a commit that referenced this issue Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:high
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants