fsprojects / fantomas

FSharp source code formatter
https://fsprojects.github.io/fantomas
Other
772 stars 194 forks source link

Backpipe is not taken into account when splitting lines #301

Closed piaste closed 5 years ago

piaste commented 6 years ago
  let token =
    JwtSecurityToken
      ( issuer = ISSUER
      , audience = ISSUER
      , claims = 
          [ 
            Claim("UserId", sprintf "%A" userId) 
            Claim("LocationId", sprintf "%A" locationId) 
            Claim("DeviceId", sprintf "%A" deviceId)
          ]
      , expires = (Nullable <| let now = DateTime.Now in now.AddDays(TOKEN_EXPIRATION_DAYS))
      , signingCredentials = credentials
      )

becomes

  let token =
    JwtSecurityToken
      (issuer = ISSUER, audience = ISSUER, 
       claims = [ Claim("UserId", sprintf "%A" userId) 
                  Claim("LocationId", sprintf "%A" locationId) 
                  Claim("DeviceId", sprintf "%A" deviceId) ], 
       expires = (Nullable <| let now = DateTime.Now
                              now.AddDays(TOKEN_EXPIRATION_DAYS)), 
       signingCredentials = credentials)

which fails to compile because the let after the backpipe doesn't create an indentation scope, so now is not recognized

jindraivanek commented 5 years ago

This is now formatted to valid code, see online.

Closing.