diff --git a/src/Fantomas.Tests/LetBindingTests.fs b/src/Fantomas.Tests/LetBindingTests.fs index c053d516aa..bddcc74412 100644 --- a/src/Fantomas.Tests/LetBindingTests.fs +++ b/src/Fantomas.Tests/LetBindingTests.fs @@ -78,4 +78,18 @@ let f () = (while true do () x) +""" + +[] +let ``DotGet on newline should be indented far enough`` () = + formatSourceString false """ +let tomorrow = + DateTimeOffset(n.Year, n.Month, n.Day, 0, 0, 0, n.Offset) + .AddDays(1.) +""" config + |> prepend newline + |> should equal """ +let tomorrow = + DateTimeOffset(n.Year, n.Month, n.Day, 0, 0, 0, n.Offset) + .AddDays(1.) """ \ No newline at end of file diff --git a/src/Fantomas/CodePrinter.fs b/src/Fantomas/CodePrinter.fs index 7717bc5440..fb111a6637 100644 --- a/src/Fantomas/CodePrinter.fs +++ b/src/Fantomas/CodePrinter.fs @@ -623,7 +623,7 @@ and genExpr astContext synExpr = | _ -> noNln (genExpr astContext e) expr - +> indent + +> indent +> (col sepNone es (fun (s, e) -> let currentExprRange = e.Range let writeExpr = (!- (sprintf ".%s" s) +> ifElse (hasParenthesis e) sepNone sepSpace +> genExpr astContext e) diff --git a/src/Fantomas/Context.fs b/src/Fantomas/Context.fs index 16d01236ff..37c14ad578 100644 --- a/src/Fantomas/Context.fs +++ b/src/Fantomas/Context.fs @@ -293,7 +293,7 @@ let internal futureNlnCheck f sep (ctx : Context) = |> Seq.indexed |> Seq.filter (fun (i, _) -> i % 2 = 0) |> Seq.map snd |> String.concat System.String.Empty let lines = withoutStringConst.Split([|Environment.NewLine|], StringSplitOptions.RemoveEmptyEntries) - (lines |> Seq.length) > 2 + (lines |> Seq.length) >= 2 /// Set a checkpoint to break at an appropriate column let internal autoNlnOrAddSep f sep (ctx : Context) =