Skip to content

Commit

Permalink
Move FormatConfig into Fantomas.Core namespace. (#2736)
Browse files Browse the repository at this point in the history
* Move FormatConfig into Fantomas.Core namespace.

* Remove unused opens.
  • Loading branch information
nojaf committed Mar 17, 2023
1 parent e1c0926 commit 240b135
Show file tree
Hide file tree
Showing 74 changed files with 69 additions and 90 deletions.
2 changes: 1 addition & 1 deletion src/Fantomas.Benchmarks/Runners.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open System.IO
open BenchmarkDotNet.Attributes
open Fantomas.Core

let config = FormatConfig.FormatConfig.Default
let config = FormatConfig.Default

[<MemoryDiagnoser>]
[<RankColumn>]
Expand Down
1 change: 0 additions & 1 deletion src/Fantomas.Core.Tests/ASTTransformerTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ open FSharp.Compiler.Xml
open FSharp.Compiler.Syntax
open FSharp.Compiler.SyntaxTrivia
open Fantomas.Core
open Fantomas.Core.FormatConfig

[<Test>]
let ``avoid stack-overflow in long array/list, 2485`` () =
Expand Down
1 change: 0 additions & 1 deletion src/Fantomas.Core.Tests/CodePrinterHelperFunctionsTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Fantomas.Core.Tests.CodePrinterHelperFunctionsTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Context
open Fantomas.Core.FormatConfig
open Fantomas.Core
open Fantomas.Core.SyntaxOak

Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/ColMultilineItemTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.ColMultilineItemTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``two short let binding should not have extra newline`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/CommentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.CommentTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``should keep sticky-to-the-left comments after nowarn directives`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/ComputationExpressionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.ComputationExpressionTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``async workflows`` () =
Expand Down
1 change: 0 additions & 1 deletion src/Fantomas.Core.Tests/ContextTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ open NUnit.Framework
open FsUnit
open Fantomas.Core.Context
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let private dump = dump false
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/ControlStructureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.ControlStructureTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``if/then/else block`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/DallasTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``proof of concept`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/DotGetTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.DotGetTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``a TypeApp inside a DotGet should stay on the same line, 994`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/DotIndexedGetTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.DotIndexedGetTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``multiline function application inside DotIndexedGet`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/FormattingSelectionOnlyTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper

let private config = FormatConfig.FormatConfig.Default
let private config = FormatConfig.Default

let private formatSelectionOnly isFsiFile selection (source: string) config =
let formattedSelection, _ =
Expand Down
1 change: 0 additions & 1 deletion src/Fantomas.Core.Tests/InterpolatedStringTests.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Fantomas.Core.Tests.InterpolatedStringTests

open FSharp.Compiler.Text
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/KeepIndentInBranchTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/KeepMaxEmptyLinesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let checkFormat config source expected =
formatSourceString false source config
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/LambdaTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.LambdaTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``keep comment after arrow`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/LetBindingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.LetBindingTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``let in should be preserved`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/ListTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.ListTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``array indices`` () =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.MultiLineLambdaClosingNewlineTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let defaultConfig = config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.MultilineBlockBracketsOnSameColumnArrayOrListTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.MultilineBlockBracketsOnSameColumnRecordTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/NumberOfItemsListOrArrayTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.NumberOfItemsListOrArrayTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``number of items sized lists are formatted properly`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/NumberOfItemsRecordTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.NumberOfItemsRecordTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
1 change: 0 additions & 1 deletion src/Fantomas.Core.Tests/OpenTypeTests.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Fantomas.Core.Tests.OpenTypeTests

open Fantomas
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/OperatorTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.OperatorTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``should format prefix operators`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/RecordTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.RecordTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

[<Test>]
let ``record declaration`` () =
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/SignatureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.SignatureTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

// the current behavior results in a compile error since "(string * string) list" is converted to "string * string list"
[<Test>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.SpaceBeforeClassConstructorTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let spaceBeforeConfig =
{ config with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
4 changes: 2 additions & 2 deletions src/Fantomas.Core.Tests/Stroustrup/ElmishTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Fantomas.Core.Tests.ElmishTests
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down Expand Up @@ -1355,7 +1355,7 @@ let Dashboard () =
]
"""
{ config with
RecordMultilineFormatter = Fantomas.Core.FormatConfig.MultilineFormatterType.NumberOfItems
RecordMultilineFormatter = MultilineFormatterType.NumberOfItems
MaxArrayOrListWidth = 20
// MaxElmishWidth = 10
MultiLineLambdaClosingNewline = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

// ExperimentalKeepIndentInBranch has precedence over ExperimentalStroustrupStyle

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

open NUnit.Framework
open FsUnit
open Fantomas.Core.FormatConfig
open Fantomas.Core
open Fantomas.Core.Tests.TestHelper

let config =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

open NUnit.Framework
open FsUnit
open Fantomas.Core.FormatConfig
open Fantomas.Core
open Fantomas.Core.Tests.TestHelper

let config =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/Stroustrup/SetExpressionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

open NUnit.Framework
open FsUnit
open Fantomas.Core.FormatConfig
open Fantomas.Core
open Fantomas.Core.Tests.TestHelper

let config =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

open NUnit.Framework
open FsUnit
open Fantomas.Core.FormatConfig
open Fantomas.Core
open Fantomas.Core.Tests.TestHelper

let config =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

open NUnit.Framework
open FsUnit
open Fantomas.Core.FormatConfig
open Fantomas.Core
open Fantomas.Core.Tests.TestHelper

let config =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
open NUnit.Framework
open FsUnit
open Fantomas.Core.Tests.TestHelper
open Fantomas.Core.FormatConfig
open Fantomas.Core

let config =
{ config with
Expand Down
Loading

0 comments on commit 240b135

Please sign in to comment.