Skip to content

Commit 7cfe8c1

Browse files
author
Josh DeGraw
committed
Fix rebase issues
1 parent aeb144d commit 7cfe8c1

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/Fantomas.Core.Tests/DallasTests.fs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
open NUnit.Framework
44
open FsUnit
55
open Fantomas.Core.Tests.TestHelper
6+
open Fantomas.Core.FormatConfig
67

78
[<Test>]
89
let ``proof of concept`` () =
@@ -1850,9 +1851,7 @@ let someTest input1 input2 =
18501851
Expect.equal input1 input2 "didn't equal"
18511852
}
18521853
"""
1853-
{ config with
1854-
ExperimentalStroustrupStyle = true
1855-
MultilineBlockBracketsOnSameColumn = true }
1854+
{ config with MultilineBracketStyle = ExperimentalStroustrup }
18561855
|> prepend newline
18571856
|> should
18581857
equal

src/Fantomas.Core/CodePrinter2.fs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
open System
44
open Fantomas.Core.Context
55
open Fantomas.Core.SyntaxOak
6+
open Fantomas.Core.FormatConfig
67

78
let noBreakInfixOps = set [| "="; ">"; "<"; "%" |]
89
let newLineInfixOps = set [ "|>"; "||>"; "|||>"; ">>"; ">>=" ]
@@ -2553,7 +2554,7 @@ let genPat (p: Pattern) =
25532554

25542555
let multilineExpressionIfAlignBrackets =
25552556
ifAlignBrackets multilineRecordExprAlignBrackets multilineRecordExpr
2556-
2557+
25572558
fun ctx ->
25582559
let size = getRecordSize ctx node.Fields
25592560
genNode node (isSmallExpression size smallRecordExpr multilineExpressionIfAlignBrackets) ctx
@@ -3330,10 +3331,7 @@ let genTypeDefn (td: TypeDefn) =
33303331
+> genSingleTextNode node.ClosingBrace
33313332

33323333
let multilineExpression (ctx: Context) =
3333-
if
3334-
ctx.Config.MultilineBlockBracketsOnSameColumn
3335-
|| (List.exists (fun (fieldNode: FieldNode) -> fieldNode.XmlDoc.IsSome) node.Fields)
3336-
then
3334+
let aligned =
33373335
let msIsEmpty = List.isEmpty members
33383336

33393337
(ifElseCtx
@@ -3351,7 +3349,12 @@ let genTypeDefn (td: TypeDefn) =
33513349
+> sepNlnTypeAndMembers typeDefnNode
33523350
+> genMemberDefnList members)
33533351
ctx
3354-
else
3352+
3353+
match ctx.Config.MultilineBracketStyle with
3354+
| Aligned
3355+
| ExperimentalStroustrup -> aligned
3356+
| Classic when (List.exists (fun (fieldNode: FieldNode) -> fieldNode.XmlDoc.IsSome) node.Fields) -> aligned
3357+
| Classic ->
33553358
(sepNlnUnlessLastEventIsNewline
33563359
+> opt (indent +> sepNln) node.Accessibility genSingleTextNode
33573360
+> genSingleTextNodeSuffixDelimiter node.OpeningBrace

src/Fantomas.Core/Fantomas.Core.fsproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020
<Compile Include="Queue.fs" />
2121
<Compile Include="Flowering.fsi" />
2222
<Compile Include="Flowering.fs" />
23-
<Compile Include="SourceParser.fs" />
24-
<Compile Include="AstTransformer.fsi" />
25-
<Compile Include="AstTransformer.fs" />
26-
<Compile Include="Version.fs" />
27-
<Compile Include="Queue.fs" />
2823
<Compile Include="Defines.fsi" />
2924
<Compile Include="Defines.fs" />
3025
<Compile Include="Context.fs" />

src/Fantomas.Core/FormatConfig.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ type FormatConfig =
218218
// [<Category("Convention")>]
219219
// [<DisplayName("Format braces using Stroustrup Style where possible.")>]
220220
// [<Description("Experimental feature, use at your own risk.")>]
221-
221+
222222
[<Category("Convention")>]
223223
[<DisplayName("How to format brackets")>]
224224
[<Description("Possible options include classic (default), aligned, and experimental_stroustrup")>]
@@ -233,6 +233,9 @@ type FormatConfig =
233233
[<Description("Pretty printing based on ASTs only.\nPlease do not use this setting for formatting hand written code!")>]
234234
StrictMode: bool }
235235

236+
member this.ExperimentalStroustrupStyle =
237+
this.MultilineBracketStyle = ExperimentalStroustrup
238+
236239
static member Default =
237240
{ IndentSize = 4
238241
MaxLineLength = 120

0 commit comments

Comments
 (0)