Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MaxDotGetExpressionWidth #3138

Merged
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
22 changes: 0 additions & 22 deletions docs/docs/end-users/Configuration.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -729,28 +729,6 @@ fsharp_max_function_binding_width = 10
"""
(*** include-output ***)

(**
<fantomas-setting green></fantomas-setting>
### fsharp_max_dot_get_expression_width
<copy-to-clipboard text="fsharp_max_dot_get_expression_width = 100"></copy-to-clipboard>

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.
*)

(*** hide ***)
printfn
$"# Default\n{toEditorConfigName (nameof FormatConfig.Default.MaxDotGetExpressionWidth)} = {FormatConfig.Default.MaxDotGetExpressionWidth}"
(*** include-output ***)

formatCode
"""
let job = JobBuilder.UsingJobData(jobDataMap).Create<WrapperJob>().Build()
"""
"""
fsharp_max_dot_get_expression_width = 60
"""
(*** include-output ***)

(**
<fantomas-setting green gr></fantomas-setting>
### fsharp_multiline_bracket_style
Expand Down
29 changes: 9 additions & 20 deletions src/Fantomas.Core.Tests/ChainTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ let ``identifier dot appUnit dot typed appUnit `` () =
"""
A.B().C<'d>()
"""
{ config with
MaxDotGetExpressionWidth = 0 }
{ config with MaxLineLength = 10 }
|> prepend newline
|> should
equal
Expand All @@ -198,8 +197,7 @@ let ``identifier dot appUnit dot typed identifier `` () =
"""
A.B().C<'d>
"""
{ config with
MaxDotGetExpressionWidth = 0 }
{ config with MaxLineLength = 10 }
|> prepend newline
|> should
equal
Expand All @@ -215,8 +213,7 @@ let ``identifier dot identifier dot appExpr dot appUnit dot index expr`` () =
"""
A.B.C(D).E().[0]
"""
{ config with
MaxDotGetExpressionWidth = 0 }
{ config with MaxLineLength = 10 }
|> prepend newline
|> should
equal
Expand All @@ -233,8 +230,7 @@ let ``identifier dot identifier dot appExpr dot identifier dot index expr`` () =
"""
A.B.C(D).E.[0]
"""
{ config with
MaxDotGetExpressionWidth = 0 }
{ config with MaxLineLength = 10 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -288,8 +284,7 @@ Map
.empty<_, obj>
.Add("headerAction", modifyHeader.Action.ArmValue)
"""
{ config with
MaxDotGetExpressionWidth = 0 }
{ config with MaxLineLength = 55 }
|> prepend newline
|> should
equal
Expand All @@ -310,7 +305,7 @@ let d = Duck()

d.Duck.Duck.Duck.Goose().Duck.Goose().Duck.Duck.Goose().Duck.Duck.Duck.Goose().Duck.Duck.Duck.Duck.Goose()
"""
config
{ config with MaxLineLength = 45 }
|> prepend newline
|> should
equal
Expand All @@ -335,9 +330,7 @@ let ``very long chain with a some index expressions`` () =
"""
Universe.Galaxy.SolarSystem.Planet.[3].Countries.[9].People.Count
"""
{ config with
MaxDotGetExpressionWidth = 0
MaxLineLength = 50 }
{ config with MaxLineLength = 50 }
|> prepend newline
|> should
equal
Expand All @@ -353,9 +346,7 @@ let ``even longer chain with only simple links`` () =
Fooooooooooo.Baaaaaaaaaaaaaaaaar.Foooooooooooooooooo.Baaaaaaaar.Basssss.Baazzzzzzzzzzzzzzzzzz.[0].Meeeeeeeeeeeeeeeeeh
.Moooooooooooooooo.Booooooooooooooooooooh.Yooooooooooooooou.Meeeeeeh.Meh2
"""
{ config with
MaxDotGetExpressionWidth = 0
MaxLineLength = 50 }
{ config with MaxLineLength = 50 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -426,9 +417,7 @@ Animal<
"Spot"
)
"""
{ config with
MaxDotGetExpressionWidth = 0
MaxLineLength = 10 }
{ config with MaxLineLength = 10 }
|> prepend newline
|> should
equal
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 @@ -1587,8 +1587,7 @@ Host

//
"""
{ config with
MaxDotGetExpressionWidth = 40 }
{ config with MaxLineLength = 55 }
|> prepend newline
|> should
equal
Expand Down
13 changes: 4 additions & 9 deletions src/Fantomas.Core.Tests/CompilerDirectivesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,7 @@ type FunctionComponent =

static member Foo = ()
"""
{ config with
MaxDotGetExpressionWidth = 50 }
config
|> should
equal
"""namespace Fable.React
Expand All @@ -673,8 +672,7 @@ type FunctionComponent =
let elemType =
ReactBindings.React.``lazy`` (fun () ->
// React.lazy requires a default export
(importValueDynamic f)
.``then`` (fun x -> createObj [ "default" ==> x ]))
(importValueDynamic f).``then`` (fun x -> createObj [ "default" ==> x ]))

fun props ->
ReactElementType.create
Expand Down Expand Up @@ -845,8 +843,7 @@ type FunctionComponent =

static member Foo = ()
"""
{ config with
MaxDotGetExpressionWidth = 50 }
config
|> should
equal
"""namespace Fable.React
Expand All @@ -867,8 +864,7 @@ type FunctionComponent =
let elemType =
ReactBindings.React.``lazy`` (fun () ->
// React.lazy requires a default export
(importValueDynamic f)
.``then`` (fun x -> createObj [ "default" ==> x ]))
(importValueDynamic f).``then`` (fun x -> createObj [ "default" ==> x ]))

fun props ->
ReactElementType.create
Expand Down Expand Up @@ -2214,7 +2210,6 @@ let loader (projectRoot: string) (siteContent: SiteContents) =
disableLiveRefresh
"""
{ config with
MaxDotGetExpressionWidth = 50
MaxInfixOperatorExpression = 50 }
|> prepend newline
|> should
Expand Down
12 changes: 3 additions & 9 deletions src/Fantomas.Core.Tests/ComputationExpressionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1001,18 +1001,13 @@ let ``let bang + do expression + let + return in ce`` () =
return Ok(user.Identity.Name, collectClaims user)
}
"""
{ config with
MaxDotGetExpressionWidth = 50 }
config
|> prepend newline
|> should
equal
"""
task {
let! config =
manager
.GetConfigurationAsync()
.ConfigureAwait(false)

let! config = manager.GetConfigurationAsync().ConfigureAwait(false)
parameters.IssuerSigningKeys <- config.SigningKeys
let user, _ = handler.ValidateToken((token: string), parameters)
return Ok(user.Identity.Name, collectClaims user)
Expand Down Expand Up @@ -2300,8 +2295,7 @@ aggregateResult {
}
"""
{ config with
MaxInfixOperatorExpression = 40
MaxDotGetExpressionWidth = 50 }
MaxInfixOperatorExpression = 40 }
|> prepend newline
|> should
equal
Expand Down
3 changes: 1 addition & 2 deletions src/Fantomas.Core.Tests/ControlStructureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,7 @@ let ``keep new line before for loop, 1317`` () =

state
"""
{ config with
MaxDotGetExpressionWidth = 60 }
{ config with MaxLineLength = 85 }
|> prepend newline
|> should
equal
Expand Down
5 changes: 1 addition & 4 deletions src/Fantomas.Core.Tests/CrampedMultilineBracketStyleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -778,9 +778,7 @@ let expect =
args = []
commands = [] }
"""
{ config with
MaxDotGetExpressionWidth = 50
MaxArrayOrListWidth = 40 }
{ config with MaxArrayOrListWidth = 40 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1988,7 +1986,6 @@ let defaultTestOptions fwk common (o: DotNet.TestOptions) =
Configuration = DotNet.BuildConfiguration.Debug }
"""
{ config with
MaxDotGetExpressionWidth = 50
MaxInfixOperatorExpression = 50
MaxRecordWidth = 55 }
|> prepend newline
Expand Down
4 changes: 2 additions & 2 deletions src/Fantomas.Core.Tests/DallasTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ let longExpr = genExpr e +> indentSepNlnUnindent (genSynLongIdentMultiline true

fun ctx ->
isShortExpression
ctx.Config.MaxDotGetExpressionWidth
ctx.Config.Blaaaaaaaaaaaaaaaaaaaaaaaaah
shortExpr
longExpr
ctx
Expand All @@ -1477,7 +1477,7 @@ fun ctx ->
let shortExpr = genExpr e +> genSynLongIdent true sli
let longExpr = genExpr e +> indentSepNlnUnindent (genSynLongIdentMultiline true sli)

fun ctx -> isShortExpression ctx.Config.MaxDotGetExpressionWidth shortExpr longExpr ctx
fun ctx -> isShortExpression ctx.Config.Blaaaaaaaaaaaaaaaaaaaaaaaaah shortExpr longExpr ctx
"""

[<Test>]
Expand Down
Loading
Loading