Skip to content

Commit b37d821

Browse files
authored
Merge pull request #3160 from dawedawe/bump_fantomas_tool_7.0.1
Bump fantomas tool 7.0.1
2 parents 2d16ee5 + 2c9c5bc commit b37d821

File tree

6 files changed

+106
-111
lines changed

6 files changed

+106
-111
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"rollForward": false
1111
},
1212
"fantomas": {
13-
"version": "6.3.9",
13+
"version": "7.0.1",
1414
"commands": [
1515
"fantomas"
1616
],

docs/docs/end-users/Configuration.fsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,7 @@ Insert a newline before a computation expression that spans multiple lines
810810

811811
(*** hide ***)
812812
printfn
813-
$"# Default\n{toEditorConfigName (nameof FormatConfig.Default.NewlineBeforeMultilineComputationExpression)} = {FormatConfig.Default.NewlineBeforeMultilineComputationExpression
814-
.ToString()
815-
.ToLower()}"
813+
$"# Default\n{toEditorConfigName (nameof FormatConfig.Default.NewlineBeforeMultilineComputationExpression)} = {FormatConfig.Default.NewlineBeforeMultilineComputationExpression.ToString().ToLower()}"
816814
(*** include-output ***)
817815

818816
formatCode
@@ -1046,9 +1044,7 @@ Top level expressions will always follow the [2020 blank lines revision](https:/
10461044

10471045
(*** hide ***)
10481046
printfn
1049-
$"# Default\n{toEditorConfigName (nameof FormatConfig.Default.BlankLinesAroundNestedMultilineExpressions)} = {FormatConfig.Default.BlankLinesAroundNestedMultilineExpressions
1050-
.ToString()
1051-
.ToLower()}"
1047+
$"# Default\n{toEditorConfigName (nameof FormatConfig.Default.BlankLinesAroundNestedMultilineExpressions)} = {FormatConfig.Default.BlankLinesAroundNestedMultilineExpressions.ToString().ToLower()}"
10521048
(*** include-output ***)
10531049

10541050
formatCode

src/Fantomas.Core.Tests/CodePrinterHelperFunctionsTests.fs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ let ``+> will compose two functions`` () =
5858
let ``partially application when composing function`` () =
5959
// We can write the previous example in a more concise way.
6060
// Because of partial application in F#: https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/functions/#partial-application-of-arguments
61-
let f = !- "f" // signature of f remains the same: Context -> Context
62-
let g = !- " and g" // signature of g remains the same: Context -> Context
61+
let f = !-"f" // signature of f remains the same: Context -> Context
62+
let g = !-" and g" // signature of g remains the same: Context -> Context
6363
let h = f +> g // signature of h remains the same: Context -> Context
6464

6565
// Conceptually, you should really read `+>` as and then.
@@ -88,7 +88,7 @@ let ``the Context module has a lot of helper functions`` () =
8888

8989
[<Test>]
9090
let ``some helper function are clever like sepSpace`` () =
91-
let f = !- "a" +> sepSpace +> sepSpace +> !- "b"
91+
let f = !-"a" +> sepSpace +> sepSpace +> !-"b"
9292

9393
let contextBefore: Context = Context.Default
9494
let contextAfter: Context = f contextBefore
@@ -102,7 +102,7 @@ let ``some helper function are clever like sepSpace`` () =
102102

103103
[<Test>]
104104
let ``other helper function respect configuration settings`` () =
105-
let f = !- "a" +> sepColon +> !- "b"
105+
let f = !-"a" +> sepColon +> !-"b"
106106
let defaultConfig: Context = Context.Default
107107
// The `FormatConfig` is present in the `Context`.
108108
let configWithSpaceBeforeTrue =
@@ -125,7 +125,7 @@ let ``traversing collections`` () =
125125
let items = [ 2; 3; 4 ]
126126
// The `col` function will traverse the collection and apply the first function between elements and the last function for each individual element.
127127
let f (items: int seq) : Context -> Context =
128-
col (!- " + ") items (fun (item: int) -> !- $"%i{item}")
128+
col (!-" + ") items (fun (item: int) -> !- $"%i{item}")
129129

130130
// Note that there are some variants of `col` that can be used to process a collection in a different way.
131131
// coli, colEx, ...
@@ -141,7 +141,7 @@ let ``newlines and indentation`` () =
141141
// Indentation only kick in on the next line, this is something to be aware of.
142142
// `sepNln` is a helper function that will add a newline.
143143

144-
let f = !- "first line" +> sepNln +> indent +> !- "second line"
144+
let f = !-"first line" +> sepNln +> indent +> !-"second line"
145145
// The dump function will respect the newline from the configuration.
146146
// For this test we will set it to `EndOfLineStyle.LF`
147147
let ctx =
@@ -154,14 +154,14 @@ let ``newlines and indentation`` () =
154154
Assert.AreEqual("first line\nsecond line", code)
155155
// There is no indentation because that would only kick in after the second line.
156156

157-
let g = !- "first line" +> indent +> sepNln +> !- "second line" +> unindent
157+
let g = !-"first line" +> indent +> sepNln +> !-"second line" +> unindent
158158
let indentedCode = g ctx |> dump
159159
Assert.AreEqual("first line\n second line", indentedCode)
160160

161161
// Using `indent` typically goes together with and `unindent` call.
162162
// This is a very common pattern in CodePrinter, so the use of `indentSepNlnUnindent` is encouraged.
163163
// Forgetting to `unindent` can be a nasty bug in Fantomas.
164-
let h = !- "first line" +> indentSepNlnUnindent (!- "second line")
164+
let h = !-"first line" +> indentSepNlnUnindent (!-"second line")
165165
let indentedCtx = h ctx
166166
let indentedCode = dump indentedCtx
167167
Assert.AreEqual("first line\n second line", indentedCode)
@@ -176,8 +176,8 @@ let ``newlines and indentation`` () =
176176
let ``trying multiple code paths`` () =
177177
// Sometimes we want to try and fit everything in a single line.
178178
// And have a fallback behavior when that is not possible.
179-
let short = !- "This fits on a single line"
180-
let long = !- "This fits on" +> sepNln +> !- "two lines"
179+
let short = !-"This fits on a single line"
180+
let long = !-"This fits on" +> sepNln +> !-"two lines"
181181
// `expressionFitsOnRestOfLine` will try the first expression and if it doesn't fit, it will try the second expression.
182182
// All the events of the first expression will be remove from the context when it needs to fallback to the second expression.
183183
let f = expressionFitsOnRestOfLine short long
@@ -242,7 +242,7 @@ let a =
242242
let genExpr (expr: Expr) =
243243
match expr with
244244
| Expr.Ident identNode -> !-identNode.Text
245-
| _ -> !- "error"
245+
| _ -> !-"error"
246246

247247
let f (genExpr: Expr -> Context -> Context) (tree: Oak) : Context -> Context =
248248
match tree.ModulesOrNamespaces.[0].Declarations.[0] with
@@ -254,8 +254,8 @@ let a =
254254
| Choice1Of2 functionNameNode ->
255255
match functionNameNode.Content with
256256
| [ IdentifierOrDot.Ident node ] -> !-node.Text
257-
| _ -> !- "error"
258-
| Choice2Of2 _ -> !- "error"
257+
| _ -> !-"error"
258+
| Choice2Of2 _ -> !-"error"
259259

260260
let genEq = !-bindingNode.Equals.Text
261261

@@ -267,7 +267,7 @@ let a =
267267
// Try to add a space and print the expression.
268268
// If the expression is multiline add indent, newline, print the expression and unindent.
269269
+> sepSpaceOrIndentAndNlnIfExpressionExceedsPageWidth (genExpr bindingNode.Expr)
270-
| _ -> !- "error"
270+
| _ -> !-"error"
271271

272272
let ctx =
273273
{ Context.Default with
@@ -302,10 +302,10 @@ let a =
302302
// If found we check the content and try to print the comment text followed by a newline
303303
match triviaNode.Content with
304304
| CommentOnSingleLine comment -> !-comment +> sepNln
305-
| _ -> !- "error"
305+
| _ -> !-"error"
306306

307307
firstComment +> !-identNode.Text
308-
| _ -> !- "error"
308+
| _ -> !-"error"
309309

310310
let codeWithTriviaPrinting = f genExprWithTrivia tree ctx |> dump
311311
Assert.AreEqual("let a =\n // code comment\n b", codeWithTriviaPrinting)
@@ -379,7 +379,7 @@ let b = 2
379379

380380
// print trivia before BindingNode
381381
enterNode node
382-
+> !- "let"
382+
+> !-"let"
383383
+> sepSpace
384384
+> !-name.Text
385385
+> sepEq
@@ -393,7 +393,7 @@ let b = 2
393393
+> sepNln
394394
+> genBinding b
395395

396-
| _ -> !- "error"
396+
| _ -> !-"error"
397397

398398
let ctx =
399399
{ Context.Default with
@@ -438,7 +438,7 @@ let b = 2
438438

439439
// print trivia before BindingNode
440440
enterNode node
441-
+> !- "let"
441+
+> !-"let"
442442
+> sepSpace
443443
+> !-name.Text
444444
+> sepEq
@@ -456,7 +456,7 @@ let b = 2
456456
+> sepNlnUnlessBindingHasTrivia b
457457
+> genBinding b
458458

459-
| _ -> !- "error"
459+
| _ -> !-"error"
460460

461461
let finalCode = g tree ctx |> dump
462462
Assert.AreEqual("let a = 1\n\nlet b = 2", finalCode)
@@ -467,7 +467,7 @@ let ``locking the indentation at a fixed column`` () =
467467
// This is typically to produce valid F# due to the offset rules.
468468
let f =
469469
sepOpenT
470-
+> atCurrentColumn (!- "first line" +> sepNln +> !- "second line")
470+
+> atCurrentColumn (!-"first line" +> sepNln +> !-"second line")
471471
+> sepCloseT
472472

473473
let ctxBefore =

src/Fantomas.Core.Tests/ContextTests.fs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ let private dump ctx = (dump false ctx).Code
1010

1111
[<Test>]
1212
let ``sepSpace should not add an additional space if the line ends with a space`` () =
13-
let expr = !- "let a = " +> sepSpace
13+
let expr = !-"let a = " +> sepSpace
1414
let result = dump (expr Context.Default)
1515
result |> should equal "let a ="
1616

1717
[<Test>]
1818
let ``sepColon should not add a space when nothing proceeds it`` () =
1919
let expr =
20-
!- "let add a b"
20+
!-"let add a b"
2121
+> indent
2222
+> sepNln
2323
+> sepColon
24-
+> !- "int ="
24+
+> !-"int ="
2525
+> indent
2626
+> sepNln
27-
+> !- "a + b"
27+
+> !-"a + b"
2828
+> unindent
2929
+> unindent
3030
+> sepNln
@@ -49,7 +49,7 @@ let add a b
4949

5050
[<Test>]
5151
let ``sepColon should not add a space when space proceeds it`` () =
52-
let expr = !- "let a " +> sepNone +> sepColon
52+
let expr = !-"let a " +> sepNone +> sepColon
5353

5454
let config =
5555
{ FormatConfig.Default with
@@ -87,15 +87,15 @@ Long comment
8787
[<Test>]
8888
let ``nested exceedsMultiline expression should bubble up to parent check`` () =
8989
let expression =
90-
!- "let a ="
90+
!-"let a ="
9191
+> autoIndentAndNlnIfExpressionExceedsPageWidth (
9292
expressionFitsOnRestOfLine
9393
// short expression, should cross the max page width of 50
94-
(!- "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +> !- "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
94+
(!-"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +> !-"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB")
9595
// fallback expression
96-
(!- "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
96+
(!-"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
9797
+> sepNln
98-
+> !- "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
98+
+> !-"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
9999
+> sepNln)
100100
)
101101

0 commit comments

Comments
 (0)