Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [8.0.0-alpha-002] - 2025-12-15

### Changed

- Breaking: change default of MultilineBracketStyle from Cramped to Aligned. [#3200](https://github.com/fsprojects/fantomas/issues/3200)

## [8.0.0-alpha-001] - 2025-12-12

### Changed
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/end-users/Configuration.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ fsharp_max_function_binding_width = 10
### fsharp_multiline_bracket_style
<copy-to-clipboard text="fsharp_multiline_bracket_style = stroustrup"></copy-to-clipboard>

`Cramped` The default way in F# to format brackets.
`Aligned` Alternative way of formatting records, arrays and lists. This will align the braces at the same column level.
`Cramped` Alternative way in F# to format brackets.
`Aligned` The default way of formatting records, arrays and lists. This will align the braces at the same column level.
`Stroustrup` Allow for easier reordering of members and keeping the code succinct.
*)

Expand Down
7 changes: 6 additions & 1 deletion docs/docs/end-users/UpgradeGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,17 @@ fsharp_experimental_stroustrup_style = true
### Miscellaneous
- The namespace in [Fantomas.FCS](https://www.nuget.org/packages/Fantomas.FCS) changed from `FSharp.Compiler` to `Fantomas.FCS`.

## v7 alpha
## v7

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

### .editorconfig
- `fsharp_max_dot_get_expression_width` was removed.

## v8 alpha

### .editorconfig
- The default setting for `fsharp_multiline_bracket_style` is now `aligned`, to restore the previous behaviour use `fsharp_multiline_bracket_style = cramped`.

<fantomas-nav previous="{{fsdocs-previous-page-link}}" next="{{fsdocs-next-page-link}}"></fantomas-nav>
9 changes: 7 additions & 2 deletions src/Fantomas.Core.Tests/AppTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Fantomas.Core.Tests.AppTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelpers
open Fantomas.Core

// the current behavior results in a compile error since the |> is merged to the last line
[<Test>]
Expand Down Expand Up @@ -648,7 +649,9 @@ let ``string interpolation should not affect multiline function applications, 17

mkMember $"this.Try{memberName}" None [ mkSynAttribute "CustomOperation" (mkSynExprConstString $"try{memberName}") ] [ parameters ] (objectStateExpr body)
"""
{ config with IndentSize = 2 }
{ config with
IndentSize = 2
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1130,7 +1133,9 @@ let ``multiline application wrapped in parentheses that equal the indent_size, 2
"""
((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" }))
"""
{ config with IndentSize = 2 }
{ config with
IndentSize = 2
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down
19 changes: 13 additions & 6 deletions src/Fantomas.Core.Tests/AttributeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open NUnit.Framework
open FsUnit

open Fantomas.Core.Tests.TestHelpers
open Fantomas.Core

[<Test>]
let ``should keep the attribute on top of the function`` () =
Expand Down Expand Up @@ -120,7 +121,8 @@ let ``type params`` () =
"""
let genericSumUnits ( x : float<'u>) (y: float<'u>) = x + y
type vector3D<[<Measure>] 'u> = { x : float<'u>; y : float<'u>; z : float<'u>}"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -179,7 +181,8 @@ type Foo =
{ [<field:DataMember>]
Bar:string }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -250,7 +253,8 @@ let ``comments before attributes should be added correctly, issue 422`` () =
Phone : string
Verified : bool }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -542,7 +546,8 @@ type Commenter =

DisplayName: string }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -658,7 +663,8 @@ type RoleAdminImportController(akkaService: AkkaService) =
"""
{ config with
MaxInfixOperatorExpression = 40
MaxArrayOrListWidth = 40 }
MaxArrayOrListWidth = 40
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -885,7 +891,8 @@ module Foo =
()
"""
{ config with
NewlineBetweenTypeDefinitionAndMembers = false }
NewlineBetweenTypeDefinitionAndMembers = false
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Fantomas.Core.Tests.BlankLinesAroundNestedMultilineExpressions
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelpers
open Fantomas.Core

let config =
{ config with
Expand Down Expand Up @@ -147,7 +148,9 @@ type MNIST(path:string, ?urls:seq<string>, ?train:bool, ?transform:Tensor->Tenso
if File.Exists(filesProcessed.[3]) then target <- dsharp.load(filesProcessed.[3]) else target <- MNIST.LoadMNISTLabels(files.[3]); dsharp.save(target, filesProcessed.[3])
data, target
"""
{ config with MaxLineLength = 100 }
{ config with
MaxLineLength = 100
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down
7 changes: 5 additions & 2 deletions src/Fantomas.Core.Tests/CastTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Fantomas.Core.Tests.CastTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelpers
open Fantomas.Core

[<Test>]
let ``multiline downcast expression, `` () =
Expand Down Expand Up @@ -145,7 +146,8 @@ module Foo =
"""
{ config with
SpaceBeforeColon = true
SpaceBeforeSemicolon = true }
SpaceBeforeSemicolon = true
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -180,7 +182,8 @@ module Foo =
"""
{ config with
SpaceBeforeColon = true
SpaceBeforeSemicolon = true }
SpaceBeforeSemicolon = true
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down
10 changes: 7 additions & 3 deletions src/Fantomas.Core.Tests/ClassTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ open NUnit.Framework
open FsUnit

open Fantomas.Core.Tests.TestHelpers
open Fantomas.Core

[<Test>]
let ``class signatures`` () =
Expand Down Expand Up @@ -511,7 +512,8 @@ module Logging =
let SetQuartzLogger l = LogProvider.SetCurrentLogProvider(l)
"""
{ config with
MaxFunctionBindingWidth = 80 }
MaxFunctionBindingWidth = 80
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1141,7 +1143,8 @@ let ``trivia before and keyword in SynMemberDefn.GetSet, 2372`` () =

override this.``type``: string = "fakerun" }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1170,7 +1173,8 @@ type [<AllowNullLiteral>] Terminal =
abstract onKey: IEvent<{| key: string; domEvent: KeyboardEvent |}> with get, set
abstract onLineFeed: IEvent<unit> with get, set
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down
3 changes: 2 additions & 1 deletion src/Fantomas.Core.Tests/ColMultilineItemTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ asyncResult {
return Ok job
}
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down
30 changes: 20 additions & 10 deletions src/Fantomas.Core.Tests/CommentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ type Model =
Name: string // bar
Street: string }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -312,7 +313,8 @@ let a =
// bar
B = 7 }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand All @@ -333,7 +335,8 @@ let a =
// bar
B = 7 }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand All @@ -356,7 +359,8 @@ let a =
B = 7 }
"""
{ config with
SpaceAroundDelimiter = false }
SpaceAroundDelimiter = false
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -586,7 +590,8 @@ module TriviaModule =

(* ending with block comment *)
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -826,7 +831,8 @@ type substring =
#endif
"""
{ config with
MaxInfixOperatorExpression = 60 }
MaxInfixOperatorExpression = 60
MultilineBracketStyle = Cramped }
|> should
equal
"""(*
Expand Down Expand Up @@ -1274,7 +1280,8 @@ type T =
; // Delay in ms since it entered the queue
delay : float }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1631,7 +1638,8 @@ type TorDirectory =
}
}
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -2330,7 +2338,8 @@ type ExprFolder<'State> =
targetIntercept: ('State -> Expr -> 'State) -> 'State -> DecisionTreeTarget -> 'State option
tmethodIntercept: ('State -> Expr -> 'State) -> 'State -> ObjExprMethod -> 'State option }
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -2447,7 +2456,8 @@ let Anonymous =
{| FontFamily = 700 // font-weight
FontSize = 48. |} // font-weight
"""
config
{ config with
MultilineBracketStyle = Cramped }
|> prepend newline
|> should
equal
Expand Down
Loading