Skip to content

Commit

Permalink
Update some default configuration values. (#2364)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf authored Jul 15, 2022
1 parent 98a7449 commit dba5578
Show file tree
Hide file tree
Showing 58 changed files with 316 additions and 207 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

## [Unreleased]
## [5.0.0-beta-001] - 2022-07-15

### Changed
* Don't mark optional parameters as required in public API. [#2350](https://github.com/fsprojects/fantomas/pull/2350)
* Update default value for v5. [#2288](https://github.com/fsprojects/fantomas/issues/2288)

### Fixed
* Content of #if block removed - Breaking Code on reformat. [#801](https://github.com/fsprojects/fantomas/issues/801)
Expand Down
29 changes: 15 additions & 14 deletions docs-old/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,19 @@ fsharp_space_before_semicolon=false
fsharp_space_after_semicolon=true
fsharp_space_around_delimiter=true
fsharp_max_if_then_short_width=0
fsharp_max_if_then_else_short_width=40
fsharp_max_infix_operator_expression=50
fsharp_max_if_then_else_short_width=60
fsharp_max_infix_operator_expression=80
fsharp_max_record_width=40
fsharp_max_record_number_of_items=1
fsharp_record_multiline_formatter=character_width
fsharp_max_array_or_list_width=40
fsharp_max_array_or_list_width=80
fsharp_max_array_or_list_number_of_items=1
fsharp_array_or_list_multiline_formatter=character_width
fsharp_max_value_binding_width=80
fsharp_max_function_binding_width=40
fsharp_max_dot_get_expression_width=50
fsharp_max_dot_get_expression_width=80
fsharp_multiline_block_brackets_on_same_column=false
fsharp_newline_between_type_definition_and_members=false
fsharp_newline_between_type_definition_and_members=true
fsharp_align_function_signature_to_indentation=false
fsharp_alternative_long_member_definitions=false
fsharp_multi_line_lambda_closing_newline=false
Expand Down Expand Up @@ -470,7 +470,7 @@ There is stated:
> e1 and e2 are not if/then/else expressions themselves.
This setting facilitates this by determining the maximum character width where the if/then/else expression stays in one line.
Default = 40.
Default = 60.

`defaultConfig`

Expand All @@ -490,7 +490,7 @@ else
### fsharp_max_infix_operator_expression

Control the maximum length for which infix expression can be on one line.
Default = 50.
Default = 80.

`defaultConfig`

Expand Down Expand Up @@ -630,8 +630,8 @@ let myRecord'' =

### fsharp_max_array_or_list_width

Control the maximum width for which lists and arrays can be in one line. Default
= 40. Requires `fsharp_array_or_list_multiline_formatter` to be
Control the maximum width for which lists and arrays can be in one line.
Default = 80. Requires `fsharp_array_or_list_multiline_formatter` to be
`character_width` to take effect.

`defaultConfig`
Expand Down Expand Up @@ -754,14 +754,15 @@ type Triangle() =
### fsharp_max_dot_get_expression_width

Control the maximum width for which (nested) [SynExpr.DotGet](https://fsharp.github.io/fsharp-compiler-docs/reference/fsharp-compiler-syntax-synexpr.html#DotGet) expressions should be in one line.
Default = 50.
Default = 80.

`defaultConfig`

```fsharp
let job =
JobBuilder
.UsingJobData(jobDataMap)
.UseSomethingElse()
.Create<WrapperJob>()
.Build()
```
Expand All @@ -770,7 +771,7 @@ let job =

```fsharp
let job =
JobBuilder.UsingJobData(jobDataMap).Create<WrapperJob>().Build()
JobBuilder.UsingJobData(jobDataMap).UseSomethingElse().Create<WrapperJob>().Build()
```

### fsharp_multiline_block_brackets_on_same_column
Expand Down Expand Up @@ -827,24 +828,24 @@ let a =
### fsharp_newline_between_type_definition_and_members

Adds a new line between a type definition and its first member.
Default = false.
Default = true.

`defaultConfig`

```fsharp
type Range =
{ From: float
To: float }
member this.Length = this.To - this.From
```

`{ defaultConfig with NewlineBetweenTypeDefinitionAndMembers = true }`
`{ defaultConfig with NewlineBetweenTypeDefinitionAndMembers = false }`

```fsharp
type Range =
{ From: float
To: float }
member this.Length = this.To - this.From
```

Expand Down
4 changes: 3 additions & 1 deletion src/Fantomas.Core.Tests/AppTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ let a =
|> List.exists (fun p ->
p.a && p.b |> List.exists (fun o -> o.a = "lorem ipsum dolor sit amet"))
"""
{ config with MaxLineLength = 80 }
{ config with
MaxLineLength = 80
MaxInfixOperatorExpression = 40 }
|> prepend newline
|> should
equal
Expand Down
12 changes: 7 additions & 5 deletions src/Fantomas.Core.Tests/AttributeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,9 @@ type RoleAdminImportController(akkaService: AkkaService) =
return Ok job
}
"""
config
{ config with
MaxInfixOperatorExpression = 40
MaxArrayOrListWidth = 40 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -820,7 +822,7 @@ and Y = B
[<ExcludeFromCodeCoverage>]
member this.M() = true
"""
config
{ config with NewlineBetweenTypeDefinitionAndMembers = false }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -952,7 +954,7 @@ module Foo =
static member doThing person =
()
"""
config
{ config with NewlineBetweenTypeDefinitionAndMembers = false }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1027,7 +1029,7 @@ module AsyncOptionCEExtensions =
type AsyncOptionBuilder with
member inline __.Source(s: #seq<_>) = s
"""
config
{ config with NewlineBetweenTypeDefinitionAndMembers = false }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1055,7 +1057,7 @@ module AsyncOptionCEExtensions =
member inline Source : string -> string
"""
config
{ config with NewlineBetweenTypeDefinitionAndMembers = false }
|> prepend newline
|> should
equal
Expand Down
8 changes: 5 additions & 3 deletions src/Fantomas.Core.Tests/ClassTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,9 @@ type Exception with
member inline __.FirstLine =
__.Message.Split([|Environment.NewLine|], StringSplitOptions.RemoveEmptyEntries).[0]
"""
{ config with MaxValueBindingWidth = 120 }
{ config with
MaxValueBindingWidth = 120
NewlineBetweenTypeDefinitionAndMembers = false }
|> should
equal
"""open System
Expand Down Expand Up @@ -711,7 +713,7 @@ indent_size=2
9
\"\"\"
"
config
{ config with MaxInfixOperatorExpression = 40 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -974,7 +976,7 @@ type C() =
with
member _.Run() = 1
"""
config
{ config with NewlineBetweenTypeDefinitionAndMembers = false }
|> prepend newline
|> should
equal
Expand Down
1 change: 0 additions & 1 deletion src/Fantomas.Core.Tests/ColMultilineItemTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ let blah<'a> config : Type =
SpaceBeforeColon = true
SpaceBeforeSemicolon = true
MultilineBlockBracketsOnSameColumn = true
NewlineBetweenTypeDefinitionAndMembers = true
AlignFunctionSignatureToIndentation = true
AlternativeLongMemberDefinitions = true
MultiLineLambdaClosingNewline = true }
Expand Down
3 changes: 1 addition & 2 deletions src/Fantomas.Core.Tests/CommentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,6 @@ open Something
SpaceBeforeColon = true
SpaceBeforeSemicolon = true
MultilineBlockBracketsOnSameColumn = true
NewlineBetweenTypeDefinitionAndMembers = true
AlignFunctionSignatureToIndentation = true
AlternativeLongMemberDefinitions = true
MultiLineLambdaClosingNewline = true
Expand Down Expand Up @@ -1645,7 +1644,7 @@ Host

//
"""
config
{ config with MaxDotGetExpressionWidth = 40 }
|> prepend newline
|> should
equal
Expand Down
14 changes: 8 additions & 6 deletions src/Fantomas.Core.Tests/CompilerDirectivesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ type FunctionComponent =
static member Foo = ()
"""
config
{ config with MaxDotGetExpressionWidth = 50 }
|> should
equal
"""namespace Fable.React
Expand Down Expand Up @@ -887,7 +887,7 @@ type FunctionComponent =
static member Foo = ()
"""
config
{ config with MaxDotGetExpressionWidth = 50 }
|> should
equal
"""namespace Fable.React
Expand Down Expand Up @@ -2274,7 +2274,9 @@ let loader (projectRoot: string) (siteContent: SiteContents) =
#endif
disableLiveRefresh
"""
config
{ config with
MaxDotGetExpressionWidth = 50
MaxInfixOperatorExpression = 50 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -2330,7 +2332,7 @@ module ReactHookExtensions =
deferred
"""
config
{ config with NewlineBetweenTypeDefinitionAndMembers = false }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -2684,7 +2686,7 @@ let isUnix =
int Environment.OSVersion.Platform |> fun p -> (p = 4) || (p = 6) || (p = 128)
#endif
"""
config
{ config with MaxInfixOperatorExpression = 40 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -2879,7 +2881,7 @@ let Run(message: string, executionContext: ExecutionContext, log: TraceWriter) =
message |> Out.Dialout.DialoutFunction.Accept logInfo getSetting
"""
config
{ config with MaxInfixOperatorExpression = 50 }
|> prepend newline
|> should
equal
Expand Down
23 changes: 15 additions & 8 deletions src/Fantomas.Core.Tests/ComputationExpressionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ let z =
|> Array.countBy id
bar
"""
config
{ config with MaxInfixOperatorExpression = 40 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1035,7 +1035,7 @@ let ``let bang + do expression + let + return in ce`` () =
return Ok(user.Identity.Name, collectClaims user)
}
"""
config
{ config with MaxDotGetExpressionWidth = 50 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1587,7 +1587,8 @@ let ``new line between let and let bang, 879`` () =
SpaceBeforeUppercaseInvocation = true
IndentSize = 2
SpaceAroundDelimiter = false
MultilineBlockBracketsOnSameColumn = true }
MultilineBlockBracketsOnSameColumn = true
MaxInfixOperatorExpression = 50 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1785,7 +1786,7 @@ let f () =
return some rather long |> stuff that |> uses piping |> to' demonstrate |> the issue
}
"""
config
{ config with MaxInfixOperatorExpression = 50 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1814,7 +1815,7 @@ let f () =
return! some rather long |> stuff that |> uses piping |> to' demonstrate |> the issue
}
"""
config
{ config with MaxInfixOperatorExpression = 50 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -2174,7 +2175,9 @@ type ProjectController(checker: FSharpChecker) =
}
"""
{ config with IndentSize = 2 }
{ config with
IndentSize = 2
MaxInfixOperatorExpression = 50 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -2212,7 +2215,9 @@ type ProjectController(checker: FSharpChecker) =
}
"""
{ config with IndentSize = 2 }
{ config with
IndentSize = 2
MaxInfixOperatorExpression = 50 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -2351,7 +2356,9 @@ aggregateResult {
More = more }
}
"""
config
{ config with
MaxInfixOperatorExpression = 40
MaxDotGetExpressionWidth = 50 }
|> prepend newline
|> should
equal
Expand Down
1 change: 0 additions & 1 deletion src/Fantomas.Core.Tests/ControlStructureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,6 @@ module Foo =
SpaceBeforeColon = true
SpaceBeforeSemicolon = true
MultilineBlockBracketsOnSameColumn = true
NewlineBetweenTypeDefinitionAndMembers = true
AlignFunctionSignatureToIndentation = true
AlternativeLongMemberDefinitions = true
MultiLineLambdaClosingNewline = true
Expand Down
Loading

0 comments on commit dba5578

Please sign in to comment.