Skip to content

BasicFormat cannot indent closure body in tuple #2084

Open
@stevapple

Description

@stevapple

Description

BasicFormat cannot indent the closure body when it's nested in a LabeledExprSyntax.

Steps to Reproduce

let builder = ExprSyntax(
  """
  .init(
      name: {
      if let name {
          return name
      } else {
          return "John"
      }
      }()
  )
  """
)
assertBuildResult(
  builder,
  """
  .init(
      name: {
          if let name {
              return name
          } else {
              return "John"
          }
      }()
  )
  """
)

outputs:

Actual output (+) differed from expected output (-):
 .init(
     name: {
–        if let name {
–            return name
–        } else {
–            return "John"
–        }
+    if let name {
+        return name
+    } else {
+        return "John"
+    }
     }()
 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    BasicFormatIncorrect formatting by BasicFormatbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions