Skip to content

Commit

Permalink
Fix rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh DeGraw committed Dec 22, 2022
1 parent b9ebd8a commit bb2e02c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/Fantomas.Core.Tests/DallasTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig

[<Test>]
let ``proof of concept`` () =
Expand Down Expand Up @@ -1850,9 +1851,7 @@ let someTest input1 input2 =
Expect.equal input1 input2 "didn't equal"
}
"""
{ config with
ExperimentalStroustrupStyle = true
MultilineBlockBracketsOnSameColumn = true }
{ config with MultilineBracketStyle = ExperimentalStroustrup }
|> prepend newline
|> should
equal
Expand Down
15 changes: 9 additions & 6 deletions src/Fantomas.Core/CodePrinter2.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
open System
open Fantomas.Core.Context
open Fantomas.Core.SyntaxOak
open Fantomas.Core.FormatConfig

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

let multilineExpressionIfAlignBrackets =
ifAlignBrackets multilineRecordExprAlignBrackets multilineRecordExpr

fun ctx ->
let size = getRecordSize ctx node.Fields
genNode node (isSmallExpression size smallRecordExpr multilineExpressionIfAlignBrackets) ctx
Expand Down Expand Up @@ -3330,10 +3331,7 @@ let genTypeDefn (td: TypeDefn) =
+> genSingleTextNode node.ClosingBrace

let multilineExpression (ctx: Context) =
if
ctx.Config.MultilineBlockBracketsOnSameColumn
|| (List.exists (fun (fieldNode: FieldNode) -> fieldNode.XmlDoc.IsSome) node.Fields)
then
let aligned =
let msIsEmpty = List.isEmpty members

(ifElseCtx
Expand All @@ -3351,7 +3349,12 @@ let genTypeDefn (td: TypeDefn) =
+> sepNlnTypeAndMembers typeDefnNode
+> genMemberDefnList members)
ctx
else

match ctx.Config.MultilineBracketStyle with
| Aligned
| ExperimentalStroustrup -> aligned
| Classic when (List.exists (fun (fieldNode: FieldNode) -> fieldNode.XmlDoc.IsSome) node.Fields) -> aligned
| Classic ->
(sepNlnUnlessLastEventIsNewline
+> opt (indent +> sepNln) node.Accessibility genSingleTextNode
+> genSingleTextNodeSuffixDelimiter node.OpeningBrace
Expand Down
5 changes: 0 additions & 5 deletions src/Fantomas.Core/Fantomas.Core.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
<Compile Include="Queue.fs" />
<Compile Include="Flowering.fsi" />
<Compile Include="Flowering.fs" />
<Compile Include="SourceParser.fs" />
<Compile Include="AstTransformer.fsi" />
<Compile Include="AstTransformer.fs" />
<Compile Include="Version.fs" />
<Compile Include="Queue.fs" />
<Compile Include="Defines.fsi" />
<Compile Include="Defines.fs" />
<Compile Include="Context.fs" />
Expand Down
5 changes: 4 additions & 1 deletion src/Fantomas.Core/FormatConfig.fs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ type FormatConfig =
// [<Category("Convention")>]
// [<DisplayName("Format braces using Stroustrup Style where possible.")>]
// [<Description("Experimental feature, use at your own risk.")>]

[<Category("Convention")>]
[<DisplayName("How to format brackets")>]
[<Description("Possible options include classic (default), aligned, and experimental_stroustrup")>]
Expand All @@ -233,6 +233,9 @@ type FormatConfig =
[<Description("Pretty printing based on ASTs only.\nPlease do not use this setting for formatting hand written code!")>]
StrictMode: bool }

member this.ExperimentalStroustrupStyle =
this.MultilineBracketStyle = ExperimentalStroustrup

static member Default =
{ IndentSize = 4
MaxLineLength = 120
Expand Down

0 comments on commit bb2e02c

Please sign in to comment.