Skip to content

Commit

Permalink
Merge pull request fsprojects#394 from nojaf/fix-381
Browse files Browse the repository at this point in the history
Fix 381
  • Loading branch information
jindraivanek authored Jan 22, 2019
2 parents 44a0b20 + 3e20f2a commit 782ebb5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/Fantomas.Tests/LetBindingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,18 @@ let f () =
(while true do
()
x)
"""

[<Test>]
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.)
"""
2 changes: 1 addition & 1 deletion src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas/Context.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down

0 comments on commit 782ebb5

Please sign in to comment.