Skip to content

Commit

Permalink
add atCurrentColumnIndent for record multiline expression (#1441)
Browse files Browse the repository at this point in the history
  • Loading branch information
btzo committed Feb 11, 2021
1 parent bd72240 commit 7783b6f
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1094,3 +1094,47 @@ type RequestParser<'ctx, 'a> =
prohibited = []
}
"""

[<Test>]
let ``formatting error with MultilineBlockBracketsOnSameColumn, 1396`` () =
formatSourceString
false
"""
namespace GeeTower.Tests.EndToEnd
module WatcherTests =
let CanRevokeAnIllegalCommitmentTx () =
let lndAddress = obj()
let config = {
GeeTower.Backend.Configuration.GetTestingConfig (lndAddress.ToString())
with
BitcoinRpcUser = "btc"
}
()
"""
{ config with
MaxLineLength = 80
MultilineBlockBracketsOnSameColumn = true }
|> prepend newline
|> should
equal
"""
namespace GeeTower.Tests.EndToEnd
module WatcherTests =
let CanRevokeAnIllegalCommitmentTx () =
let lndAddress = obj ()
let config =
{ GeeTower.Backend.Configuration.GetTestingConfig(
lndAddress.ToString()
) with
BitcoinRpcUser = "btc"
}
()
"""
2 changes: 1 addition & 1 deletion src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2757,7 +2757,7 @@ and genMultilineRecordInstanceAlignBrackets

| None, Some e ->
sepOpenS
+> genExpr astContext e
+> atCurrentColumnIndent (genExpr astContext e)
+> (!- " with"
+> indent
+> whenShortIndent indent
Expand Down

0 comments on commit 7783b6f

Please sign in to comment.