Skip to content

Commit 5ade168

Browse files
authored
Merge pull request #3207 from nojaf/change-default
Change default for MultilineBracketStyle
2 parents 59b060d + 82efef3 commit 5ade168

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+434
-190
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [8.0.0-alpha-002] - 2025-12-15
4+
5+
### Changed
6+
7+
- Breaking: change default of MultilineBracketStyle from Cramped to Aligned. [#3200](https://github.com/fsprojects/fantomas/issues/3200)
8+
39
## [8.0.0-alpha-001] - 2025-12-12
410

511
### Changed

docs/docs/end-users/Configuration.fsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,8 @@ fsharp_max_function_binding_width = 10
734734
### fsharp_multiline_bracket_style
735735
<copy-to-clipboard text="fsharp_multiline_bracket_style = stroustrup"></copy-to-clipboard>
736736
737-
`Cramped` The default way in F# to format brackets.
738-
`Aligned` Alternative way of formatting records, arrays and lists. This will align the braces at the same column level.
737+
`Cramped` Alternative way in F# to format brackets.
738+
`Aligned` The default way of formatting records, arrays and lists. This will align the braces at the same column level.
739739
`Stroustrup` Allow for easier reordering of members and keeping the code succinct.
740740
*)
741741

docs/docs/end-users/UpgradeGuide.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,17 @@ fsharp_experimental_stroustrup_style = true
8282
### Miscellaneous
8383
- The namespace in [Fantomas.FCS](https://www.nuget.org/packages/Fantomas.FCS) changed from `FSharp.Compiler` to `Fantomas.FCS`.
8484

85-
## v7 alpha
85+
## v7
8686

8787
### console application
8888
- Target framework is now `net8.0`.
8989

9090
### .editorconfig
9191
- `fsharp_max_dot_get_expression_width` was removed.
9292

93+
## v8 alpha
94+
95+
### .editorconfig
96+
- The default setting for `fsharp_multiline_bracket_style` is now `aligned`, to restore the previous behaviour use `fsharp_multiline_bracket_style = cramped`.
97+
9398
<fantomas-nav previous="{{fsdocs-previous-page-link}}" next="{{fsdocs-next-page-link}}"></fantomas-nav>

src/Fantomas.Core.Tests/AppTests.fs

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

78
// the current behavior results in a compile error since the |> is merged to the last line
89
[<Test>]
@@ -648,7 +649,9 @@ let ``string interpolation should not affect multiline function applications, 17
648649
649650
mkMember $"this.Try{memberName}" None [ mkSynAttribute "CustomOperation" (mkSynExprConstString $"try{memberName}") ] [ parameters ] (objectStateExpr body)
650651
"""
651-
{ config with IndentSize = 2 }
652+
{ config with
653+
IndentSize = 2
654+
MultilineBracketStyle = Cramped }
652655
|> prepend newline
653656
|> should
654657
equal
@@ -1130,7 +1133,9 @@ let ``multiline application wrapped in parentheses that equal the indent_size, 2
11301133
"""
11311134
((Combo { e1 = "Making this long so it goes on a new line new line new line new line making it long so it goes on a new line new line" }))
11321135
"""
1133-
{ config with IndentSize = 2 }
1136+
{ config with
1137+
IndentSize = 2
1138+
MultilineBracketStyle = Cramped }
11341139
|> prepend newline
11351140
|> should
11361141
equal

src/Fantomas.Core.Tests/AttributeTests.fs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ open NUnit.Framework
44
open FsUnit
55

66
open Fantomas.Core.Tests.TestHelpers
7+
open Fantomas.Core
78

89
[<Test>]
910
let ``should keep the attribute on top of the function`` () =
@@ -120,7 +121,8 @@ let ``type params`` () =
120121
"""
121122
let genericSumUnits ( x : float<'u>) (y: float<'u>) = x + y
122123
type vector3D<[<Measure>] 'u> = { x : float<'u>; y : float<'u>; z : float<'u>}"""
123-
config
124+
{ config with
125+
MultilineBracketStyle = Cramped }
124126
|> prepend newline
125127
|> should
126128
equal
@@ -179,7 +181,8 @@ type Foo =
179181
{ [<field:DataMember>]
180182
Bar:string }
181183
"""
182-
config
184+
{ config with
185+
MultilineBracketStyle = Cramped }
183186
|> prepend newline
184187
|> should
185188
equal
@@ -250,7 +253,8 @@ let ``comments before attributes should be added correctly, issue 422`` () =
250253
Phone : string
251254
Verified : bool }
252255
"""
253-
config
256+
{ config with
257+
MultilineBracketStyle = Cramped }
254258
|> prepend newline
255259
|> should
256260
equal
@@ -542,7 +546,8 @@ type Commenter =
542546
543547
DisplayName: string }
544548
"""
545-
config
549+
{ config with
550+
MultilineBracketStyle = Cramped }
546551
|> prepend newline
547552
|> should
548553
equal
@@ -658,7 +663,8 @@ type RoleAdminImportController(akkaService: AkkaService) =
658663
"""
659664
{ config with
660665
MaxInfixOperatorExpression = 40
661-
MaxArrayOrListWidth = 40 }
666+
MaxArrayOrListWidth = 40
667+
MultilineBracketStyle = Cramped }
662668
|> prepend newline
663669
|> should
664670
equal
@@ -885,7 +891,8 @@ module Foo =
885891
()
886892
"""
887893
{ config with
888-
NewlineBetweenTypeDefinitionAndMembers = false }
894+
NewlineBetweenTypeDefinitionAndMembers = false
895+
MultilineBracketStyle = Cramped }
889896
|> prepend newline
890897
|> should
891898
equal

src/Fantomas.Core.Tests/BlankLinesAroundNestedMultilineExpressions.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module Fantomas.Core.Tests.BlankLinesAroundNestedMultilineExpressions
33
open NUnit.Framework
44
open FsUnit
55
open Fantomas.Core.Tests.TestHelpers
6+
open Fantomas.Core
67

78
let config =
89
{ config with
@@ -147,7 +148,9 @@ type MNIST(path:string, ?urls:seq<string>, ?train:bool, ?transform:Tensor->Tenso
147148
if File.Exists(filesProcessed.[3]) then target <- dsharp.load(filesProcessed.[3]) else target <- MNIST.LoadMNISTLabels(files.[3]); dsharp.save(target, filesProcessed.[3])
148149
data, target
149150
"""
150-
{ config with MaxLineLength = 100 }
151+
{ config with
152+
MaxLineLength = 100
153+
MultilineBracketStyle = Cramped }
151154
|> prepend newline
152155
|> should
153156
equal

src/Fantomas.Core.Tests/CastTests.fs

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

78
[<Test>]
89
let ``multiline downcast expression, `` () =
@@ -145,7 +146,8 @@ module Foo =
145146
"""
146147
{ config with
147148
SpaceBeforeColon = true
148-
SpaceBeforeSemicolon = true }
149+
SpaceBeforeSemicolon = true
150+
MultilineBracketStyle = Cramped }
149151
|> prepend newline
150152
|> should
151153
equal
@@ -180,7 +182,8 @@ module Foo =
180182
"""
181183
{ config with
182184
SpaceBeforeColon = true
183-
SpaceBeforeSemicolon = true }
185+
SpaceBeforeSemicolon = true
186+
MultilineBracketStyle = Cramped }
184187
|> prepend newline
185188
|> should
186189
equal

src/Fantomas.Core.Tests/ClassTests.fs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ open NUnit.Framework
44
open FsUnit
55

66
open Fantomas.Core.Tests.TestHelpers
7+
open Fantomas.Core
78

89
[<Test>]
910
let ``class signatures`` () =
@@ -511,7 +512,8 @@ module Logging =
511512
let SetQuartzLogger l = LogProvider.SetCurrentLogProvider(l)
512513
"""
513514
{ config with
514-
MaxFunctionBindingWidth = 80 }
515+
MaxFunctionBindingWidth = 80
516+
MultilineBracketStyle = Cramped }
515517
|> prepend newline
516518
|> should
517519
equal
@@ -1141,7 +1143,8 @@ let ``trivia before and keyword in SynMemberDefn.GetSet, 2372`` () =
11411143
11421144
override this.``type``: string = "fakerun" }
11431145
"""
1144-
config
1146+
{ config with
1147+
MultilineBracketStyle = Cramped }
11451148
|> prepend newline
11461149
|> should
11471150
equal
@@ -1170,7 +1173,8 @@ type [<AllowNullLiteral>] Terminal =
11701173
abstract onKey: IEvent<{| key: string; domEvent: KeyboardEvent |}> with get, set
11711174
abstract onLineFeed: IEvent<unit> with get, set
11721175
"""
1173-
config
1176+
{ config with
1177+
MultilineBracketStyle = Cramped }
11741178
|> prepend newline
11751179
|> should
11761180
equal

src/Fantomas.Core.Tests/ColMultilineItemTests.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ asyncResult {
215215
return Ok job
216216
}
217217
"""
218-
config
218+
{ config with
219+
MultilineBracketStyle = Cramped }
219220
|> prepend newline
220221
|> should
221222
equal

src/Fantomas.Core.Tests/CommentTests.fs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ type Model =
116116
Name: string // bar
117117
Street: string }
118118
"""
119-
config
119+
{ config with
120+
MultilineBracketStyle = Cramped }
120121
|> prepend newline
121122
|> should
122123
equal
@@ -312,7 +313,8 @@ let a =
312313
// bar
313314
B = 7 }
314315
"""
315-
config
316+
{ config with
317+
MultilineBracketStyle = Cramped }
316318
|> prepend newline
317319
|> should
318320
equal
@@ -333,7 +335,8 @@ let a =
333335
// bar
334336
B = 7 }
335337
"""
336-
config
338+
{ config with
339+
MultilineBracketStyle = Cramped }
337340
|> prepend newline
338341
|> should
339342
equal
@@ -356,7 +359,8 @@ let a =
356359
B = 7 }
357360
"""
358361
{ config with
359-
SpaceAroundDelimiter = false }
362+
SpaceAroundDelimiter = false
363+
MultilineBracketStyle = Cramped }
360364
|> prepend newline
361365
|> should
362366
equal
@@ -586,7 +590,8 @@ module TriviaModule =
586590

587591
(* ending with block comment *)
588592
"""
589-
config
593+
{ config with
594+
MultilineBracketStyle = Cramped }
590595
|> prepend newline
591596
|> should
592597
equal
@@ -826,7 +831,8 @@ type substring =
826831
#endif
827832
"""
828833
{ config with
829-
MaxInfixOperatorExpression = 60 }
834+
MaxInfixOperatorExpression = 60
835+
MultilineBracketStyle = Cramped }
830836
|> should
831837
equal
832838
"""(*
@@ -1274,7 +1280,8 @@ type T =
12741280
; // Delay in ms since it entered the queue
12751281
delay : float }
12761282
"""
1277-
config
1283+
{ config with
1284+
MultilineBracketStyle = Cramped }
12781285
|> prepend newline
12791286
|> should
12801287
equal
@@ -1631,7 +1638,8 @@ type TorDirectory =
16311638
}
16321639
}
16331640
"""
1634-
config
1641+
{ config with
1642+
MultilineBracketStyle = Cramped }
16351643
|> prepend newline
16361644
|> should
16371645
equal
@@ -2330,7 +2338,8 @@ type ExprFolder<'State> =
23302338
targetIntercept: ('State -> Expr -> 'State) -> 'State -> DecisionTreeTarget -> 'State option
23312339
tmethodIntercept: ('State -> Expr -> 'State) -> 'State -> ObjExprMethod -> 'State option }
23322340
"""
2333-
config
2341+
{ config with
2342+
MultilineBracketStyle = Cramped }
23342343
|> prepend newline
23352344
|> should
23362345
equal
@@ -2447,7 +2456,8 @@ let Anonymous =
24472456
{| FontFamily = 700 // font-weight
24482457
FontSize = 48. |} // font-weight
24492458
"""
2450-
config
2459+
{ config with
2460+
MultilineBracketStyle = Cramped }
24512461
|> prepend newline
24522462
|> should
24532463
equal

0 commit comments

Comments
 (0)