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

Inline lambda in argument list causes problems for argument chopping and lambda alignment #1028

Closed
3 tasks
cmeeren opened this issue Aug 24, 2020 · 2 comments
Closed
3 tasks

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Aug 24, 2020

Issue created from fantomas-online

Code

module Lifecycle =


  let init config =
    async {
      cfg <- config
      do!
        MassTransit.init
          cfg.LoggerFactory cfg.AzureServiceBusConnStr cfg.QueueName cfg.LoggerFactory
          (fun reg ->
            reg.Consume User.handleUserInitiatedRegistration
            reg.Consume User.handleUserUpdated
            reg.Consume User.handleGetSessionUserIdRequest
          )
    }

Result

module Lifecycle =


  let init config =
    async {
      cfg <- config
      do! MassTransit.init cfg.LoggerFactory cfg.AzureServiceBusConnStr
            cfg.QueueName cfg.LoggerFactory (fun reg ->
            reg.Consume User.handleUserInitiatedRegistration
            reg.Consume User.handleUserUpdated
            reg.Consume User.handleGetSessionUserIdRequest)
    }

Problem description

Due to the inline lambda, the arguments don't break correctly. I would expect:

module Lifecycle =


  let init config =
    async {
      cfg <- config
      do! MassTransit.init
            cfg.LoggerFactory
            cfg.AzureServiceBusConnStr
            cfg.QueueName
            cfg.LoggerFactory
            (fun reg ->
               reg.Consume User.handleUserInitiatedRegistration
               reg.Consume User.handleUserUpdated
               reg.Consume User.handleGetSessionUserIdRequest)
    }

Or something similar.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this. (I'll help in any way I can except implementation; I don't have the capacity to ramp up on a new codebase now)

Options

Fantomas Master at 08/21/2020 08:12:02 - 8665356

    { config with
                IndentSize = 2
                MaxLineLength = 80 }
@cmeeren cmeeren changed the title <Insert meaningful title> Inline lambda in argument list causes problems for argument chopping and lambda alignment Aug 24, 2020
@cmeeren
Copy link
Contributor Author

cmeeren commented Jan 28, 2021

Judging from fantomas-online, this seems to be fixed in 4.3.

@nojaf
Copy link
Contributor

nojaf commented Jan 30, 2021

Great, I'll add a regression test someday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants