diff --git a/Directory.Packages.props b/Directory.Packages.props
index 6c08d8b3b9..b9571097c2 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -3,7 +3,7 @@
true
-
+
diff --git a/Directory.Solution.targets b/Directory.Solution.targets
index ee1676023c..a60010141b 100644
--- a/Directory.Solution.targets
+++ b/Directory.Solution.targets
@@ -1,7 +1,7 @@
-
+
diff --git a/build.fsx b/build.fsx
index e6959b968a..40727d5522 100644
--- a/build.fsx
+++ b/build.fsx
@@ -1,6 +1,5 @@
#r "nuget: Fun.Build, 1.0.3"
#r "nuget: CliWrap, 3.6.4"
-#r "nuget: FSharp.Data, 6.3.0"
#r "nuget: Ionide.KeepAChangelog, 0.1.8"
#r "nuget: Humanizer.Core, 2.14.1"
@@ -10,9 +9,6 @@ open System.IO
open Fun.Build
open CliWrap
open CliWrap.Buffered
-open FSharp.Data
-open System.Xml.Linq
-open System.Xml.XPath
open Ionide.KeepAChangelog
open Ionide.KeepAChangelog.Domain
open SemVersion
@@ -73,6 +69,15 @@ let semanticVersioning =
> "net6.0"
> "SemanticVersioning.dll"
+let fcs =
+ __SOURCE_DIRECTORY__
+ > "src"
+ > "Fantomas"
+ > "bin"
+ > "Release"
+ > "net6.0"
+ > "FSharp.Compiler.Service.dll"
+
let pushPackage nupkg =
async {
let key = Environment.GetEnvironmentVariable("NUGET_KEY")
@@ -116,7 +121,7 @@ pipeline "Build" {
[| "DOTNET_ROLL_FORWARD_TO_PRERELEASE", "1"
"DOTNET_ROLL_FORWARD", "LatestMajor" |]
run
- $"dotnet fsdocs build --clean --properties Configuration=Release --fscoptions \" -r:{semanticVersioning}\" --eval --strict --nonpublic"
+ $"dotnet fsdocs build --clean --properties Configuration=Release --fscoptions \" -r:{semanticVersioning} -r:{fcs}\" --eval --strict --nonpublic"
}
runIfOnlySpecified false
}
@@ -208,7 +213,7 @@ pipeline "Docs" {
[| "DOTNET_ROLL_FORWARD_TO_PRERELEASE", "1"
"DOTNET_ROLL_FORWARD", "LatestMajor" |]
run
- $"dotnet fsdocs watch --properties Configuration=Release --fscoptions \" -r:{semanticVersioning}\" --eval --nonpublic"
+ $"dotnet fsdocs watch --properties Configuration=Release --fscoptions \" -r:{semanticVersioning} -r:{fcs}\" --eval --nonpublic"
}
runIfOnlySpecified true
}
@@ -225,132 +230,6 @@ pipeline "EnsureRepoConfig" {
runIfOnlySpecified true
}
-let deps = __SOURCE_DIRECTORY__ > ".deps"
-
-let fsharpCompilerHash =
- let xDoc = XElement.Load(__SOURCE_DIRECTORY__ > "Directory.Build.props")
- xDoc.XPathSelectElements("//FCSCommitHash") |> Seq.head |> (fun xe -> xe.Value)
-
-let updateFileRaw (file: FileInfo) =
- let lines = File.ReadAllLines file.FullName
- let updatedLines =
- lines
- |> Array.map (fun line ->
- if line.Contains("FSharp.Compiler") then
- line.Replace("FSharp.Compiler", "Fantomas.FCS")
- else
- line)
- File.WriteAllLines(file.FullName, updatedLines)
-
-let downloadCompilerFile commitHash relativePath =
- async {
- let file = FileInfo(deps > commitHash > relativePath)
- if file.Exists && file.Length <> 0 then
- return ()
- else
- file.Directory.Create()
- let fs = file.Create()
- let fileName = Path.GetFileName(relativePath)
- let url =
- $"https://raw.githubusercontent.com/dotnet/fsharp/{commitHash}/{relativePath}"
- let! response =
- Http.AsyncRequestStream(
- url,
- headers = [| "Content-Disposition", $"attachment; filename=\"{fileName}\"" |]
- )
- if response.StatusCode <> 200 then
- printfn $"Could not download %s{relativePath}"
- do! Async.AwaitTask(response.ResponseStream.CopyToAsync(fs))
- fs.Close()
-
- updateFileRaw file
- }
-
-pipeline "Init" {
- workingDir __SOURCE_DIRECTORY__
- stage "Download FCS files" {
- run (fun _ ->
- [| "src/Compiler/FSComp.txt"
- "src/Compiler/FSStrings.resx"
- "src/Compiler/Utilities/Activity.fsi"
- "src/Compiler/Utilities/Activity.fs"
- "src/Compiler/Utilities/sformat.fsi"
- "src/Compiler/Utilities/sformat.fs"
- "src/Compiler/Utilities/sr.fsi"
- "src/Compiler/Utilities/sr.fs"
- "src/Compiler/Utilities/ResizeArray.fsi"
- "src/Compiler/Utilities/ResizeArray.fs"
- "src/Compiler/Utilities/HashMultiMap.fsi"
- "src/Compiler/Utilities/HashMultiMap.fs"
- "src/Compiler/Utilities/TaggedCollections.fsi"
- "src/Compiler/Utilities/TaggedCollections.fs"
- "src/Compiler/Utilities/illib.fsi"
- "src/Compiler/Utilities/illib.fs"
- "src/Compiler/Utilities/Cancellable.fsi"
- "src/Compiler/Utilities/Cancellable.fs"
- "src/Compiler/Utilities/FileSystem.fsi"
- "src/Compiler/Utilities/FileSystem.fs"
- "src/Compiler/Utilities/ildiag.fsi"
- "src/Compiler/Utilities/ildiag.fs"
- "src/Compiler/Utilities/zmap.fsi"
- "src/Compiler/Utilities/zmap.fs"
- "src/Compiler/Utilities/zset.fsi"
- "src/Compiler/Utilities/zset.fs"
- "src/Compiler/Utilities/XmlAdapters.fsi"
- "src/Compiler/Utilities/XmlAdapters.fs"
- "src/Compiler/Utilities/InternalCollections.fsi"
- "src/Compiler/Utilities/InternalCollections.fs"
- "src/Compiler/Utilities/lib.fsi"
- "src/Compiler/Utilities/lib.fs"
- "src/Compiler/Utilities/PathMap.fsi"
- "src/Compiler/Utilities/PathMap.fs"
- "src/Compiler/Utilities/range.fsi"
- "src/Compiler/Utilities/range.fs"
- "src/Compiler/Facilities/LanguageFeatures.fsi"
- "src/Compiler/Facilities/LanguageFeatures.fs"
- "src/Compiler/Facilities/DiagnosticOptions.fsi"
- "src/Compiler/Facilities/DiagnosticOptions.fs"
- "src/Compiler/Facilities/DiagnosticsLogger.fsi"
- "src/Compiler/Facilities/DiagnosticsLogger.fs"
- "src/Compiler/Facilities/prim-lexing.fsi"
- "src/Compiler/Facilities/prim-lexing.fs"
- "src/Compiler/Facilities/prim-parsing.fsi"
- "src/Compiler/Facilities/prim-parsing.fs"
- "src/Compiler/AbstractIL/illex.fsl"
- "src/Compiler/AbstractIL/ilpars.fsy"
- "src/Compiler/AbstractIL/il.fsi"
- "src/Compiler/AbstractIL/il.fs"
- "src/Compiler/AbstractIL/ilascii.fsi"
- "src/Compiler/AbstractIL/ilascii.fs"
- "src/Compiler/SyntaxTree/PrettyNaming.fsi"
- "src/Compiler/SyntaxTree/PrettyNaming.fs"
- "src/Compiler/pplex.fsl"
- "src/Compiler/pppars.fsy"
- "src/Compiler/lex.fsl"
- "src/Compiler/pars.fsy"
- "src/Compiler/SyntaxTree/UnicodeLexing.fsi"
- "src/Compiler/SyntaxTree/UnicodeLexing.fs"
- "src/Compiler/SyntaxTree/XmlDoc.fsi"
- "src/Compiler/SyntaxTree/XmlDoc.fs"
- "src/Compiler/SyntaxTree/SyntaxTrivia.fsi"
- "src/Compiler/SyntaxTree/SyntaxTrivia.fs"
- "src/Compiler/SyntaxTree/SyntaxTree.fsi"
- "src/Compiler/SyntaxTree/SyntaxTree.fs"
- "src/Compiler/SyntaxTree/SyntaxTreeOps.fsi"
- "src/Compiler/SyntaxTree/SyntaxTreeOps.fs"
- "src/Compiler/SyntaxTree/ParseHelpers.fsi"
- "src/Compiler/SyntaxTree/ParseHelpers.fs"
- "src/Compiler/SyntaxTree/LexHelpers.fsi"
- "src/Compiler/SyntaxTree/LexHelpers.fs"
- "src/Compiler/SyntaxTree/LexFilter.fsi"
- "src/Compiler/SyntaxTree/LexFilter.fs" |]
- |> Array.map (downloadCompilerFile fsharpCompilerHash)
- |> Async.Parallel
- |> Async.Ignore)
- }
- runIfOnlySpecified true
-}
-
type GithubRelease =
{ Version: string
Title: string
diff --git a/docs/docs/end-users/Configuration.fsx b/docs/docs/end-users/Configuration.fsx
index 565d333b73..a7e1642f11 100644
--- a/docs/docs/end-users/Configuration.fsx
+++ b/docs/docs/end-users/Configuration.fsx
@@ -20,7 +20,7 @@ UI might be available depending on the IDE.
*)
(*** hide ***)
-#r "../../../src/Fantomas/bin/Release/net6.0/Fantomas.FCS.dll"
+#r "../../../src/Fantomas/bin/Release/net6.0/FSharp.Compiler.Service.dll"
#r "../../../src/Fantomas/bin/Release/net6.0/Fantomas.Core.dll"
printf $"version: {Fantomas.Core.CodeFormatter.GetVersion()}"
diff --git a/docs/docs/end-users/GeneratingCode.fsx b/docs/docs/end-users/GeneratingCode.fsx
index 4ead8ae3b2..38aec4e95c 100644
--- a/docs/docs/end-users/GeneratingCode.fsx
+++ b/docs/docs/end-users/GeneratingCode.fsx
@@ -32,10 +32,10 @@ In simple scenarios this can work out, but in the long run it doesn't scale well
To illustrate the API, lets generate a simple value binding: `let a = 0`.
*)
-#r "../../../src/Fantomas/bin/Release/net6.0/Fantomas.FCS.dll"
+#r "../../../src/Fantomas/bin/Release/net6.0/FSharp.Compiler.Service.dll"
#r "../../../src/Fantomas/bin/Release/net6.0/Fantomas.Core.dll" // In production use #r "nuget: Fantomas.Core, 6.*"
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
open Fantomas.Core.SyntaxOak
let implementationSyntaxTree =
@@ -98,8 +98,6 @@ Example usage:
*)
-open Fantomas.FCS
-
Parse.parseFile false (SourceText.ofString "let a = 1") []
(*** include-it ***)
diff --git a/fantomas.sln b/fantomas.sln
index 455820b02b..6f199f1581 100644
--- a/fantomas.sln
+++ b/fantomas.sln
@@ -22,8 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{29F22904-C
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fantomas.Client", "src\Fantomas.Client\Fantomas.Client.fsproj", "{AA895F94-CCF2-4FCF-A9BB-E16987B57535}"
EndProject
-Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fantomas.FCS", "src\Fantomas.FCS\Fantomas.FCS.fsproj", "{B39D50EE-0307-4C08-81F5-97418A946F63}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{965B1FF9-B438-4F74-ACCA-A78062AD606E}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
@@ -125,18 +123,6 @@ Global
{AA895F94-CCF2-4FCF-A9BB-E16987B57535}.Release|x64.Build.0 = Release|Any CPU
{AA895F94-CCF2-4FCF-A9BB-E16987B57535}.Release|x86.ActiveCfg = Release|Any CPU
{AA895F94-CCF2-4FCF-A9BB-E16987B57535}.Release|x86.Build.0 = Release|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Debug|x64.ActiveCfg = Debug|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Debug|x64.Build.0 = Debug|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Debug|x86.ActiveCfg = Debug|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Debug|x86.Build.0 = Debug|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Release|Any CPU.Build.0 = Release|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Release|x64.ActiveCfg = Release|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Release|x64.Build.0 = Release|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Release|x86.ActiveCfg = Release|Any CPU
- {B39D50EE-0307-4C08-81F5-97418A946F63}.Release|x86.Build.0 = Release|Any CPU
{68814E36-3957-4D1C-BCDB-84C3C8478BEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68814E36-3957-4D1C-BCDB-84C3C8478BEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68814E36-3957-4D1C-BCDB-84C3C8478BEC}.Debug|x64.ActiveCfg = Debug|Any CPU
diff --git a/src/Fantomas.Benchmarks/packages.lock.json b/src/Fantomas.Benchmarks/packages.lock.json
index ef58c5089a..184fe55a78 100644
--- a/src/Fantomas.Benchmarks/packages.lock.json
+++ b/src/Fantomas.Benchmarks/packages.lock.json
@@ -31,9 +31,9 @@
},
"FSharp.Core": {
"type": "Direct",
- "requested": "[6.0.1, )",
- "resolved": "6.0.1",
- "contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
+ "requested": "[8.0.100, )",
+ "resolved": "8.0.100",
+ "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
@@ -201,8 +201,8 @@
},
"Microsoft.NETCore.Targets": {
"type": "Transitive",
- "resolved": "1.1.3",
- "contentHash": "3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ=="
+ "resolved": "1.1.0",
+ "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg=="
},
"Microsoft.Win32.Primitives": {
"type": "Transitive",
@@ -399,15 +399,8 @@
},
"System.Buffers": {
"type": "Transitive",
- "resolved": "4.3.0",
- "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==",
- "dependencies": {
- "System.Diagnostics.Debug": "4.3.0",
- "System.Diagnostics.Tracing": "4.3.0",
- "System.Resources.ResourceManager": "4.3.0",
- "System.Runtime": "4.3.0",
- "System.Threading": "4.3.0"
- }
+ "resolved": "4.5.1",
+ "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.CodeDom": {
"type": "Transitive",
@@ -443,8 +436,8 @@
},
"System.Collections.Immutable": {
"type": "Transitive",
- "resolved": "5.0.0",
- "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g=="
+ "resolved": "7.0.0",
+ "contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ=="
},
"System.Console": {
"type": "Transitive",
@@ -724,15 +717,8 @@
},
"System.Reflection.Emit": {
"type": "Transitive",
- "resolved": "4.3.0",
- "contentHash": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==",
- "dependencies": {
- "System.IO": "4.3.0",
- "System.Reflection": "4.3.0",
- "System.Reflection.Emit.ILGeneration": "4.3.0",
- "System.Reflection.Primitives": "4.3.0",
- "System.Runtime": "4.3.0"
- }
+ "resolved": "4.7.0",
+ "contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ=="
},
"System.Reflection.Emit.ILGeneration": {
"type": "Transitive",
@@ -768,8 +754,11 @@
},
"System.Reflection.Metadata": {
"type": "Transitive",
- "resolved": "5.0.0",
- "contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ=="
+ "resolved": "7.0.0",
+ "contentHash": "MclTG61lsD9sYdpNz9xsKBzjsmsfCtcMZYXz/IUr2zlhaTaABonlr1ESeompTgM+Xk+IwtGYU7/voh3YWB/fWw==",
+ "dependencies": {
+ "System.Collections.Immutable": "7.0.0"
+ }
},
"System.Reflection.Primitives": {
"type": "Transitive",
@@ -804,8 +793,8 @@
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
- "resolved": "5.0.0",
- "contentHash": "ZD9TMpsmYJLrxbbmdvhwt9YEgG5WntEnZ/d1eH8JBX9LBp+Ju8BSBhUGbZMNVHHomWo2KVImJhTDl2hIgw/6MA=="
+ "resolved": "6.0.0",
+ "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Runtime.Extensions": {
"type": "Transitive",
@@ -1139,24 +1128,38 @@
"fantomas.core": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "Fantomas.FCS": "[1.0.0, )"
+ "FSharp.Compiler.Service": "[43.8.200, )",
+ "FSharp.Core": "[8.0.100, )"
}
},
- "fantomas.fcs": {
+ "fsharp.compiler.service": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "System.Diagnostics.DiagnosticSource": "[7.0.0, )",
+ "FSharp.Core": "[8.0.100, )",
+ "FSharp.DependencyManager.Nuget": "[8.0.200, )",
+ "System.Buffers": "[4.5.1, )",
+ "System.Collections.Immutable": "[7.0.0, )",
+ "System.Diagnostics.DiagnosticSource": "[7.0.2, )",
"System.Memory": "[4.5.5, )",
- "System.Runtime": "[4.3.1, )"
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
+ }
+ },
+ "fsharp.dependencymanager.nuget": {
+ "type": "Project",
+ "dependencies": {
+ "FSharp.Core": "[8.0.100, )",
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
}
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
- "resolved": "7.0.0",
- "contentHash": "9W0ewWDuAyDqS2PigdTxk6jDKonfgscY/hP8hm7VpxYhNHZHKvZTdRckberlFk3VnCmr3xBUyMBut12Q+T2aOw=="
+ "resolved": "7.0.2",
+ "contentHash": "hYr3I9N9811e0Bjf2WNwAGGyTuAFbbTgX1RPLt/3Wbm68x3IGcX5Cl75CMmgT6WlNwLQ2tCCWfqYPpypjaf2xA=="
},
"System.Memory": {
"type": "CentralTransitive",
@@ -1167,11 +1170,11 @@
"System.Runtime": {
"type": "CentralTransitive",
"requested": "[4.3.1, )",
- "resolved": "4.3.1",
- "contentHash": "abhfv1dTK6NXOmu4bgHIONxHyEqFjW8HwXPmpY9gmll+ix9UNo4XDcmzJn6oLooftxNssVHdJC1pGT9jkSynQg==",
+ "resolved": "4.3.0",
+ "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==",
"dependencies": {
- "Microsoft.NETCore.Platforms": "1.1.1",
- "Microsoft.NETCore.Targets": "1.1.3"
+ "Microsoft.NETCore.Platforms": "1.1.0",
+ "Microsoft.NETCore.Targets": "1.1.0"
}
}
}
diff --git a/src/Fantomas.Client.Tests/packages.lock.json b/src/Fantomas.Client.Tests/packages.lock.json
index 23534d71c3..1a4ceabf40 100644
--- a/src/Fantomas.Client.Tests/packages.lock.json
+++ b/src/Fantomas.Client.Tests/packages.lock.json
@@ -19,9 +19,9 @@
},
"FSharp.Core": {
"type": "Direct",
- "requested": "[6.0.1, )",
- "resolved": "6.0.1",
- "contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
+ "requested": "[8.0.100, )",
+ "resolved": "8.0.100",
+ "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
diff --git a/src/Fantomas.Core.Tests/ASTTransformerTests.fs b/src/Fantomas.Core.Tests/ASTTransformerTests.fs
index af3c60616a..1afdff97a3 100644
--- a/src/Fantomas.Core.Tests/ASTTransformerTests.fs
+++ b/src/Fantomas.Core.Tests/ASTTransformerTests.fs
@@ -1,10 +1,10 @@
module Fantomas.Core.Tests.ASTTransformerTests
open NUnit.Framework
-open Fantomas.FCS.Text
-open Fantomas.FCS.Xml
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.SyntaxTrivia
+open FSharp.Compiler.Text
+open FSharp.Compiler.Xml
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.SyntaxTrivia
open Fantomas.Core
[]
diff --git a/src/Fantomas.Core.Tests/CodeFormatterTests.fs b/src/Fantomas.Core.Tests/CodeFormatterTests.fs
index b396a37a48..b8a8b2018e 100644
--- a/src/Fantomas.Core.Tests/CodeFormatterTests.fs
+++ b/src/Fantomas.Core.Tests/CodeFormatterTests.fs
@@ -1,7 +1,7 @@
module Fantomas.Core.Tests.CodeFormatterTests
open NUnit.Framework
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
open Fantomas.Core
open Fantomas.Core.SyntaxOak
open Fantomas.Core.Tests.TestHelpers
@@ -81,8 +81,7 @@ let b = 0
#endif
"""
- let ast, _ =
- Fantomas.FCS.Parse.parseFile false (SourceText.ofString source) [ "DEBUG" ]
+ let ast, _ = Parse.parseFile false (SourceText.ofString source) [ "DEBUG" ]
let oak = CodeFormatter.TransformAST(ast, source)
@@ -102,7 +101,7 @@ let b = 0
"""
let ast, _ =
- Fantomas.FCS.Parse.parseFile false (SourceText.ofString source) [ "DEBUG"; "FOO"; "BAR" ]
+ Parse.parseFile false (SourceText.ofString source) [ "DEBUG"; "FOO"; "BAR" ]
let oak = CodeFormatter.TransformAST ast
@@ -120,7 +119,7 @@ module A
let b = 0
"""
- let ast, _ = Fantomas.FCS.Parse.parseFile false (SourceText.ofString source) []
+ let ast, _ = Parse.parseFile false (SourceText.ofString source) []
let oak = CodeFormatter.TransformAST(ast, source)
diff --git a/src/Fantomas.Core.Tests/CodePrinterHelperFunctionsTests.fs b/src/Fantomas.Core.Tests/CodePrinterHelperFunctionsTests.fs
index 14807ca848..29268fcc9e 100644
--- a/src/Fantomas.Core.Tests/CodePrinterHelperFunctionsTests.fs
+++ b/src/Fantomas.Core.Tests/CodePrinterHelperFunctionsTests.fs
@@ -2,6 +2,7 @@ module Fantomas.Core.Tests.CodePrinterHelperFunctionsTests
open NUnit.Framework
open FsUnit
+open FSharp.Compiler.Text
open Fantomas.Core.Context
open Fantomas.Core
open Fantomas.Core.SyntaxOak
@@ -209,7 +210,7 @@ let a =
// Let's create a dummy Oak
// In practise, a FCS Syntax tree will be transformed to an Oak
- let zeroRange = Fantomas.FCS.Text.Range.Zero
+ let zeroRange = Range.Zero
let stn text = SingleTextNode(text, zeroRange)
let tree =
@@ -321,7 +322,7 @@ let b = 2
"""
// Imagine that we always want to print a new line between let bindings.
- let zeroRange = Fantomas.FCS.Text.Range.Zero
+ let zeroRange = Range.Zero
let stn text = SingleTextNode(text, zeroRange)
let mkBinding name body =
diff --git a/src/Fantomas.Core.Tests/CursorTests.fs b/src/Fantomas.Core.Tests/CursorTests.fs
index 5f23838cc4..923c66c45d 100644
--- a/src/Fantomas.Core.Tests/CursorTests.fs
+++ b/src/Fantomas.Core.Tests/CursorTests.fs
@@ -1,6 +1,6 @@
module Fantomas.Core.Tests.CursorTests
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
open NUnit.Framework
open FsUnit
open Fantomas.Core
diff --git a/src/Fantomas.Core.Tests/DefinesTests.fs b/src/Fantomas.Core.Tests/DefinesTests.fs
index 04cfe97f50..146f4fa7c5 100644
--- a/src/Fantomas.Core.Tests/DefinesTests.fs
+++ b/src/Fantomas.Core.Tests/DefinesTests.fs
@@ -2,14 +2,14 @@ module Fantomas.Core.Tests.TokenParserTests
open NUnit.Framework
open FsUnit
-open Fantomas.FCS.Syntax
+open FSharp.Compiler.Syntax
open Fantomas.Core
open Fantomas.Core.Defines
open Fantomas.Core.Tests.TestHelpers
let private getDefines (v: string) =
let sourceText = CodeFormatterImpl.getSourceText v
- let baseUntypedTree, _diagnostics = Fantomas.FCS.Parse.parseFile false sourceText []
+ let baseUntypedTree, _diagnostics = Parse.parseFile false sourceText []
let hashDirectives =
match baseUntypedTree with
diff --git a/src/Fantomas.Core.Tests/FormattingSelectionOnlyTests.fs b/src/Fantomas.Core.Tests/FormattingSelectionOnlyTests.fs
index 6099d0d19a..e555a4e469 100644
--- a/src/Fantomas.Core.Tests/FormattingSelectionOnlyTests.fs
+++ b/src/Fantomas.Core.Tests/FormattingSelectionOnlyTests.fs
@@ -1,6 +1,6 @@
module Fantomas.Core.Tests.FormattingSelectionOnlyTests
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
open Fantomas.Core
open NUnit.Framework
open FsUnit
diff --git a/src/Fantomas.Core.Tests/SynLongIdentTests.fs b/src/Fantomas.Core.Tests/SynLongIdentTests.fs
index fc008c2cef..b6c22be53c 100644
--- a/src/Fantomas.Core.Tests/SynLongIdentTests.fs
+++ b/src/Fantomas.Core.Tests/SynLongIdentTests.fs
@@ -1,9 +1,9 @@
module Fantomas.Core.Tests.SynLongIdentTests
-open Fantomas.FCS.Text
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.SyntaxTrivia
-open Fantomas.FCS.Xml
+open FSharp.Compiler.Text
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.SyntaxTrivia
+open FSharp.Compiler.Xml
open NUnit.Framework
open FsUnit
open Fantomas.Core
diff --git a/src/Fantomas.Core.Tests/TestHelpers.fs b/src/Fantomas.Core.Tests/TestHelpers.fs
index 236ee7ca97..4871009db8 100644
--- a/src/Fantomas.Core.Tests/TestHelpers.fs
+++ b/src/Fantomas.Core.Tests/TestHelpers.fs
@@ -42,7 +42,7 @@ let formatSourceString = formatFSharpString false
let formatAST isFsiFile (source: string) config =
async {
let ast, _ =
- Fantomas.FCS.Parse.parseFile isFsiFile (Fantomas.FCS.Text.SourceText.ofString source) []
+ Parse.parseFile isFsiFile (FSharp.Compiler.Text.SourceText.ofString source) []
let! formattedCode = CodeFormatter.FormatASTAsync(ast, config = config)
let! isValid = CodeFormatter.IsValidFSharpCodeAsync(isFsiFile, formattedCode)
diff --git a/src/Fantomas.Core.Tests/packages.lock.json b/src/Fantomas.Core.Tests/packages.lock.json
index cecfb7546f..0a18161ca4 100644
--- a/src/Fantomas.Core.Tests/packages.lock.json
+++ b/src/Fantomas.Core.Tests/packages.lock.json
@@ -22,9 +22,9 @@
},
"FSharp.Core": {
"type": "Direct",
- "requested": "[6.0.1, )",
- "resolved": "6.0.1",
- "contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
+ "requested": "[8.0.100, )",
+ "resolved": "8.0.100",
+ "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"FsUnit": {
"type": "Direct",
@@ -86,13 +86,13 @@
},
"Microsoft.NETCore.Platforms": {
"type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "TMBuzAHpTenGbGgk0SMTwyEkyijY/Eae4ZGsFNYJvAr/LDn1ku3Etp3FPxChmDp5HHF3kzJuoaa08N0xjqAJfQ=="
+ "resolved": "1.1.0",
+ "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
},
"Microsoft.NETCore.Targets": {
"type": "Transitive",
- "resolved": "1.1.3",
- "contentHash": "3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ=="
+ "resolved": "1.1.0",
+ "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg=="
},
"Microsoft.TestPlatform.ObjectModel": {
"type": "Transitive",
@@ -300,15 +300,8 @@
},
"System.Buffers": {
"type": "Transitive",
- "resolved": "4.3.0",
- "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==",
- "dependencies": {
- "System.Diagnostics.Debug": "4.3.0",
- "System.Diagnostics.Tracing": "4.3.0",
- "System.Resources.ResourceManager": "4.3.0",
- "System.Runtime": "4.3.0",
- "System.Threading": "4.3.0"
- }
+ "resolved": "4.5.1",
+ "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections": {
"type": "Transitive",
@@ -337,6 +330,11 @@
"System.Threading.Tasks": "4.3.0"
}
},
+ "System.Collections.Immutable": {
+ "type": "Transitive",
+ "resolved": "7.0.0",
+ "contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ=="
+ },
"System.Console": {
"type": "Transitive",
"resolved": "4.3.0",
@@ -605,15 +603,8 @@
},
"System.Reflection.Emit": {
"type": "Transitive",
- "resolved": "4.3.0",
- "contentHash": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==",
- "dependencies": {
- "System.IO": "4.3.0",
- "System.Reflection": "4.3.0",
- "System.Reflection.Emit.ILGeneration": "4.3.0",
- "System.Reflection.Primitives": "4.3.0",
- "System.Runtime": "4.3.0"
- }
+ "resolved": "4.7.0",
+ "contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ=="
},
"System.Reflection.Emit.ILGeneration": {
"type": "Transitive",
@@ -649,8 +640,11 @@
},
"System.Reflection.Metadata": {
"type": "Transitive",
- "resolved": "1.6.0",
- "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ=="
+ "resolved": "7.0.0",
+ "contentHash": "MclTG61lsD9sYdpNz9xsKBzjsmsfCtcMZYXz/IUr2zlhaTaABonlr1ESeompTgM+Xk+IwtGYU7/voh3YWB/fWw==",
+ "dependencies": {
+ "System.Collections.Immutable": "7.0.0"
+ }
},
"System.Reflection.Primitives": {
"type": "Transitive",
@@ -683,6 +677,11 @@
"System.Runtime": "4.3.0"
}
},
+ "System.Runtime.CompilerServices.Unsafe": {
+ "type": "Transitive",
+ "resolved": "6.0.0",
+ "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
+ },
"System.Runtime.Extensions": {
"type": "Transitive",
"resolved": "4.3.0",
@@ -1019,24 +1018,38 @@
"fantomas.core": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "Fantomas.FCS": "[1.0.0, )"
+ "FSharp.Compiler.Service": "[43.8.200, )",
+ "FSharp.Core": "[8.0.100, )"
}
},
- "fantomas.fcs": {
+ "fsharp.compiler.service": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "System.Diagnostics.DiagnosticSource": "[7.0.0, )",
+ "FSharp.Core": "[8.0.100, )",
+ "FSharp.DependencyManager.Nuget": "[8.0.200, )",
+ "System.Buffers": "[4.5.1, )",
+ "System.Collections.Immutable": "[7.0.0, )",
+ "System.Diagnostics.DiagnosticSource": "[7.0.2, )",
"System.Memory": "[4.5.5, )",
- "System.Runtime": "[4.3.1, )"
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
+ }
+ },
+ "fsharp.dependencymanager.nuget": {
+ "type": "Project",
+ "dependencies": {
+ "FSharp.Core": "[8.0.100, )",
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
}
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
- "resolved": "7.0.0",
- "contentHash": "9W0ewWDuAyDqS2PigdTxk6jDKonfgscY/hP8hm7VpxYhNHZHKvZTdRckberlFk3VnCmr3xBUyMBut12Q+T2aOw=="
+ "resolved": "7.0.2",
+ "contentHash": "hYr3I9N9811e0Bjf2WNwAGGyTuAFbbTgX1RPLt/3Wbm68x3IGcX5Cl75CMmgT6WlNwLQ2tCCWfqYPpypjaf2xA=="
},
"System.Memory": {
"type": "CentralTransitive",
@@ -1047,11 +1060,11 @@
"System.Runtime": {
"type": "CentralTransitive",
"requested": "[4.3.1, )",
- "resolved": "4.3.1",
- "contentHash": "abhfv1dTK6NXOmu4bgHIONxHyEqFjW8HwXPmpY9gmll+ix9UNo4XDcmzJn6oLooftxNssVHdJC1pGT9jkSynQg==",
+ "resolved": "4.3.0",
+ "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==",
"dependencies": {
- "Microsoft.NETCore.Platforms": "1.1.1",
- "Microsoft.NETCore.Targets": "1.1.3"
+ "Microsoft.NETCore.Platforms": "1.1.0",
+ "Microsoft.NETCore.Targets": "1.1.0"
}
}
}
diff --git a/src/Fantomas.Core/ASTTransformer.fs b/src/Fantomas.Core/ASTTransformer.fs
index 8883611b85..08e12c0f86 100644
--- a/src/Fantomas.Core/ASTTransformer.fs
+++ b/src/Fantomas.Core/ASTTransformer.fs
@@ -2,12 +2,11 @@
open System.Collections.Generic
open System.Text.RegularExpressions
-open Fantomas.FCS.Text
-open Fantomas.FCS.Text.Range
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.SyntaxTrivia
-open Fantomas.FCS.Xml
-open Fantomas.Core.ISourceTextExtensions
+open FSharp.Compiler.Text
+open FSharp.Compiler.Text.Range
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.SyntaxTrivia
+open FSharp.Compiler.Xml
open Fantomas.Core.RangePatterns
open Fantomas.Core.SyntaxOak
open Microsoft.FSharp.Core
@@ -19,7 +18,7 @@ type CreationAide =
member x.TextFromSource fallback range =
match x.SourceText with
| None -> fallback ()
- | Some sourceText -> sourceText.GetContentAt range
+ | Some sourceText -> sourceText.GetSubTextFromRange range
let stn text range = SingleTextNode(text, range)
@@ -3141,7 +3140,7 @@ let mkModuleOrNamespace
| Some leadingKeyword ->
match name with
| None ->
- let m = mkFileIndexRange range.FileIndex range.Start leadingKeyword.Range.End
+ let m = mkRange range.FileName range.Start leadingKeyword.Range.End
ModuleOrNamespaceHeaderNode(
mkXmlDoc xmlDoc,
@@ -3154,7 +3153,7 @@ let mkModuleOrNamespace
)
|> Some
| Some name ->
- let m = mkFileIndexRange range.FileIndex range.Start name.Range.End
+ let m = mkRange range.FileName range.Start name.Range.End
ModuleOrNamespaceHeaderNode(
mkXmlDoc xmlDoc,
@@ -3467,7 +3466,7 @@ let mkModuleOrNamespaceSig
| Some leadingKeyword ->
match name with
| None ->
- let m = mkFileIndexRange range.FileIndex range.Start leadingKeyword.Range.End
+ let m = mkRange range.FileName range.Start leadingKeyword.Range.End
ModuleOrNamespaceHeaderNode(
mkXmlDoc xmlDoc,
@@ -3480,7 +3479,7 @@ let mkModuleOrNamespaceSig
)
|> Some
| Some name ->
- let m = mkFileIndexRange range.FileIndex range.Start name.Range.End
+ let m = mkRange range.FileName range.Start name.Range.End
ModuleOrNamespaceHeaderNode(
mkXmlDoc xmlDoc,
diff --git a/src/Fantomas.Core/ASTTransformer.fsi b/src/Fantomas.Core/ASTTransformer.fsi
index 1b0a8fe6db..1a3a10fd55 100644
--- a/src/Fantomas.Core/ASTTransformer.fsi
+++ b/src/Fantomas.Core/ASTTransformer.fsi
@@ -1,7 +1,7 @@
module internal Fantomas.Core.ASTTransformer
-open Fantomas.FCS.Text
-open Fantomas.FCS.Syntax
+open FSharp.Compiler.Text
+open FSharp.Compiler.Syntax
open Fantomas.Core.SyntaxOak
val mkOak: sourceText: ISourceText option -> ast: ParsedInput -> Oak
diff --git a/src/Fantomas.Core/CodeFormatter.fs b/src/Fantomas.Core/CodeFormatter.fs
index de70e9071d..f1c8fbdaf4 100644
--- a/src/Fantomas.Core/CodeFormatter.fs
+++ b/src/Fantomas.Core/CodeFormatter.fs
@@ -1,7 +1,7 @@
namespace Fantomas.Core
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.Text
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.Text
open Fantomas.Core.SyntaxOak
[]
diff --git a/src/Fantomas.Core/CodeFormatter.fsi b/src/Fantomas.Core/CodeFormatter.fsi
index 85fb76c538..7ec7f6a7bc 100644
--- a/src/Fantomas.Core/CodeFormatter.fsi
+++ b/src/Fantomas.Core/CodeFormatter.fsi
@@ -1,7 +1,7 @@
namespace Fantomas.Core
-open Fantomas.FCS.Text
-open Fantomas.FCS.Syntax
+open FSharp.Compiler.Text
+open FSharp.Compiler.Syntax
open Fantomas.Core.SyntaxOak
[]
diff --git a/src/Fantomas.Core/CodeFormatterImpl.fs b/src/Fantomas.Core/CodeFormatterImpl.fs
index a517ea42f1..4cb4f9d883 100644
--- a/src/Fantomas.Core/CodeFormatterImpl.fs
+++ b/src/Fantomas.Core/CodeFormatterImpl.fs
@@ -1,17 +1,16 @@
[]
module internal Fantomas.Core.CodeFormatterImpl
-open Fantomas.FCS.Diagnostics
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.Text
+open FSharp.Compiler.Diagnostics
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.Text
open MultipleDefineCombinations
let getSourceText (source: string) : ISourceText = source.TrimEnd() |> SourceText.ofString
let parse (isSignature: bool) (source: ISourceText) : Async<(ParsedInput * DefineCombination) array> =
// First get the syntax tree without any defines
- let baseUntypedTree, baseDiagnostics =
- Fantomas.FCS.Parse.parseFile isSignature source []
+ let baseUntypedTree, baseDiagnostics = Parse.parseFile isSignature source []
let hashDirectives =
match baseUntypedTree with
@@ -37,7 +36,7 @@ let parse (isSignature: bool) (source: ISourceText) : Async<(ParsedInput * Defin
|> List.map (fun defineCombination ->
async {
let untypedTree, diagnostics =
- Fantomas.FCS.Parse.parseFile isSignature source defineCombination.Value
+ Parse.parseFile isSignature source defineCombination.Value
let errors =
diagnostics
diff --git a/src/Fantomas.Core/CodeFormatterImpl.fsi b/src/Fantomas.Core/CodeFormatterImpl.fsi
index 8035aeb7a2..ffdf7f81d1 100644
--- a/src/Fantomas.Core/CodeFormatterImpl.fsi
+++ b/src/Fantomas.Core/CodeFormatterImpl.fsi
@@ -1,8 +1,8 @@
[]
module internal Fantomas.Core.CodeFormatterImpl
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.Text
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.Text
val getSourceText: source: string -> ISourceText
diff --git a/src/Fantomas.Core/CodeFormatterTypes.fs b/src/Fantomas.Core/CodeFormatterTypes.fs
index f052975ecd..446d447e99 100644
--- a/src/Fantomas.Core/CodeFormatterTypes.fs
+++ b/src/Fantomas.Core/CodeFormatterTypes.fs
@@ -1,6 +1,6 @@
namespace Fantomas.Core
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
[]
type FormatResult =
diff --git a/src/Fantomas.Core/CodePrinter.fs b/src/Fantomas.Core/CodePrinter.fs
index d1f2476efe..a7d86bfb00 100644
--- a/src/Fantomas.Core/CodePrinter.fs
+++ b/src/Fantomas.Core/CodePrinter.fs
@@ -1,9 +1,10 @@
module internal rec Fantomas.Core.CodePrinter
open System
+open Microsoft.FSharp.Core.CompilerServices
+open FSharp.Compiler.Text
open Fantomas.Core.Context
open Fantomas.Core.SyntaxOak
-open Microsoft.FSharp.Core.CompilerServices
let noBreakInfixOps = set [| "="; ">"; "<"; "%" |]
let newLineInfixOps = set [ "|>"; "||>"; "|||>"; ">>"; ">>=" ]
@@ -102,7 +103,7 @@ let genTrivia (node: Node) (trivia: TriviaNode) (ctx: Context) =
let originalColumnOffset = trivia.Range.EndColumn - node.Range.EndColumn
let formattedCursor =
- Fantomas.FCS.Text.Position.mkPos ctx.WriterModel.Lines.Length (ctx.Column + originalColumnOffset)
+ Position.mkPos ctx.WriterModel.Lines.Length (ctx.Column + originalColumnOffset)
{ ctx with
FormattedCursor = Some formattedCursor }
@@ -122,7 +123,7 @@ let recordCursorNode f (node: Node) (ctx: Context) =
let formattedCursor =
let columnOffsetInSource = cursor.Column - node.Range.StartColumn
- Fantomas.FCS.Text.Position.mkPos currentStartLine (currentStartColumn + columnOffsetInSource)
+ Position.mkPos currentStartLine (currentStartColumn + columnOffsetInSource)
{ ctxAfter with
FormattedCursor = Some formattedCursor }
@@ -793,8 +794,7 @@ let genExpr (e: Expr) =
match node.SubsequentExpressions with
| [] -> genExpr node.LeadingExpr
| (operator, e2) :: es ->
- let m =
- Fantomas.FCS.Text.Range.unionRanges (Expr.Node node.LeadingExpr).Range (Expr.Node e2).Range
+ let m = Range.unionRanges (Expr.Node node.LeadingExpr).Range (Expr.Node e2).Range
genMultilineInfixExpr (ExprInfixAppNode(node.LeadingExpr, operator, e2, m))
+> sepNln
@@ -1037,9 +1037,9 @@ let genExpr (e: Expr) =
let parenExpr =
mkExprParenNode
node.OpeningParen
- (Expr.Null(SingleTextNode("", Fantomas.FCS.Text.Range.Zero)))
+ (Expr.Null(SingleTextNode("", Range.Zero)))
node.ClosingParen
- Fantomas.FCS.Text.Range.Zero
+ Range.Zero
sepSpaceBeforeParenInFuncInvocation node.FunctionName parenExpr
| _ -> sepSpace
@@ -1853,18 +1853,9 @@ let genTupleExpr (node: ExprTupleNode) =
match exprInfixAppNode.RightHandSide with
| IsLambdaOrIfThenElse e ->
let parenNode =
- mkExprParenNode
- (SingleTextNode("(", Fantomas.FCS.Text.Range.Zero))
- e
- (SingleTextNode(")", Fantomas.FCS.Text.Range.Zero))
- Fantomas.FCS.Text.Range.Zero
-
- ExprInfixAppNode(
- exprInfixAppNode.LeftHandSide,
- exprInfixAppNode.Operator,
- parenNode,
- Fantomas.FCS.Text.range.Zero
- )
+ mkExprParenNode (SingleTextNode("(", Range.Zero)) e (SingleTextNode(")", Range.Zero)) Range.Zero
+
+ ExprInfixAppNode(exprInfixAppNode.LeftHandSide, exprInfixAppNode.Operator, parenNode, range.Zero)
|> Expr.InfixApp
| _ -> expr
| _ -> expr
diff --git a/src/Fantomas.Core/Context.fs b/src/Fantomas.Core/Context.fs
index b6b2a60a5d..a167c33b14 100644
--- a/src/Fantomas.Core/Context.fs
+++ b/src/Fantomas.Core/Context.fs
@@ -1,7 +1,7 @@
module internal Fantomas.Core.Context
open System
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
open Fantomas.Core
open Fantomas.Core.SyntaxOak
diff --git a/src/Fantomas.Core/Context.fsi b/src/Fantomas.Core/Context.fsi
index 9118d47469..3ee81d4a89 100644
--- a/src/Fantomas.Core/Context.fsi
+++ b/src/Fantomas.Core/Context.fsi
@@ -1,6 +1,6 @@
module internal Fantomas.Core.Context
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
open Fantomas.Core.SyntaxOak
type WriterEvent =
diff --git a/src/Fantomas.Core/Defines.fs b/src/Fantomas.Core/Defines.fs
index a74693d8d9..63b650c1a3 100644
--- a/src/Fantomas.Core/Defines.fs
+++ b/src/Fantomas.Core/Defines.fs
@@ -1,6 +1,6 @@
namespace Fantomas.Core
-open Fantomas.FCS.SyntaxTrivia
+open FSharp.Compiler.SyntaxTrivia
open Fantomas.Core
type internal DefineCombination =
diff --git a/src/Fantomas.Core/Defines.fsi b/src/Fantomas.Core/Defines.fsi
index 5f9709b552..e3d2381c0e 100644
--- a/src/Fantomas.Core/Defines.fsi
+++ b/src/Fantomas.Core/Defines.fsi
@@ -8,6 +8,6 @@ type internal DefineCombination =
static member Empty: DefineCombination
module internal Defines =
- open Fantomas.FCS.SyntaxTrivia
+ open FSharp.Compiler.SyntaxTrivia
val getDefineCombination: hashDirectives: ConditionalDirectiveTrivia list -> DefineCombination list
diff --git a/src/Fantomas.Core/Fantomas.Core.fsproj b/src/Fantomas.Core/Fantomas.Core.fsproj
index 9772cd28c2..e0293a2ca9 100644
--- a/src/Fantomas.Core/Fantomas.Core.fsproj
+++ b/src/Fantomas.Core/Fantomas.Core.fsproj
@@ -8,8 +8,7 @@
-
-
+
@@ -44,6 +43,6 @@
-
+
\ No newline at end of file
diff --git a/src/Fantomas.Core/FormatConfig.fs b/src/Fantomas.Core/FormatConfig.fs
index e2abad7247..da87c86634 100644
--- a/src/Fantomas.Core/FormatConfig.fs
+++ b/src/Fantomas.Core/FormatConfig.fs
@@ -2,9 +2,9 @@ namespace Fantomas.Core
open System
open System.ComponentModel
-open Fantomas.FCS.Parse
+open FSharp.Compiler.Diagnostics
-exception ParseException of diagnostics: FSharpParserDiagnostic list
+exception ParseException of diagnostics: FSharpDiagnostic list
type FormatException(msg: string) =
inherit Exception(msg)
diff --git a/src/Fantomas.Core/ISourceTextExtensions.fs b/src/Fantomas.Core/ISourceTextExtensions.fs
deleted file mode 100644
index bb5ac709d6..0000000000
--- a/src/Fantomas.Core/ISourceTextExtensions.fs
+++ /dev/null
@@ -1,24 +0,0 @@
-module Fantomas.Core.ISourceTextExtensions
-
-open System.Text
-open Fantomas.FCS.Text
-
-type ISourceText with
-
- member x.GetContentAt(range: range) : string =
- let startLine = range.StartLine - 1
- let line = x.GetLineString startLine
-
- if range.StartLine = range.EndLine then
- let length = range.EndColumn - range.StartColumn
- line.Substring(range.StartColumn, length)
- else
- let firstLineContent = line.Substring(range.StartColumn)
- let sb = StringBuilder().AppendLine(firstLineContent)
-
- (sb, [ range.StartLine .. range.EndLine - 2 ])
- ||> List.fold (fun sb lineNumber -> sb.AppendLine(x.GetLineString lineNumber))
- |> fun sb ->
- let lastLine = x.GetLineString(range.EndLine - 1)
-
- sb.Append(lastLine.Substring(0, range.EndColumn)).ToString()
diff --git a/src/Fantomas.Core/ISourceTextExtensions.fsi b/src/Fantomas.Core/ISourceTextExtensions.fsi
deleted file mode 100644
index 22dc4d2976..0000000000
--- a/src/Fantomas.Core/ISourceTextExtensions.fsi
+++ /dev/null
@@ -1,7 +0,0 @@
-module Fantomas.Core.ISourceTextExtensions
-
-open Fantomas.FCS.Text
-
-type ISourceText with
-
- member GetContentAt: range: range -> string
diff --git a/src/Fantomas.Core/MultipleDefineCombinations.fs b/src/Fantomas.Core/MultipleDefineCombinations.fs
index 7986565152..47efdca855 100644
--- a/src/Fantomas.Core/MultipleDefineCombinations.fs
+++ b/src/Fantomas.Core/MultipleDefineCombinations.fs
@@ -4,7 +4,7 @@ open System
open System.Text
open System.Text.RegularExpressions
open Microsoft.FSharp.Core.CompilerServices
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
/// A CodeFragment represents a chunk of code that is either
/// a single conditional hash directive line,
diff --git a/src/Fantomas.Core/Parse.fs b/src/Fantomas.Core/Parse.fs
new file mode 100644
index 0000000000..b2a49d51a3
--- /dev/null
+++ b/src/Fantomas.Core/Parse.fs
@@ -0,0 +1,33 @@
+module Fantomas.Core.Parse
+
+open System
+open FSharp.Compiler.CodeAnalysis
+open FSharp.Compiler.Diagnostics
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.Text
+
+let private checker =
+ FSharpChecker.Create(captureIdentifiersWhenParsing = false, useSyntaxTreeCache = false)
+
+let parseFile
+ (isSignature: bool)
+ (sourceText: ISourceText)
+ (defines: string list)
+ : ParsedInput * FSharpDiagnostic list =
+ let fileName =
+ sprintf "%s.%s" (Guid.NewGuid().ToString("N")) (if isSignature then "fsi" else "fs")
+
+ let parsingOptions =
+ { FSharpParsingOptions.Default with
+ SourceFiles = [| fileName |]
+ IndentationAwareSyntax = Some true
+ ConditionalDefines = defines
+ LangVersionText = "preview"
+ IsExe = true
+ OnlyUseSpecifiedDefines = true }
+
+ let parseResult =
+ checker.ParseFile(fileName, sourceText, parsingOptions, false)
+ |> Async.RunSynchronously
+
+ parseResult.ParseTree, List.ofArray parseResult.Diagnostics
diff --git a/src/Fantomas.Core/RangeHelpers.fs b/src/Fantomas.Core/RangeHelpers.fs
index 16f3863cd6..19d1d9c563 100644
--- a/src/Fantomas.Core/RangeHelpers.fs
+++ b/src/Fantomas.Core/RangeHelpers.fs
@@ -1,17 +1,17 @@
namespace Fantomas.Core
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
[]
module RangeHelpers =
- /// Checks if Range B is fully contained by Range A
- let rangeContainsRange (a: Range) (b: Range) =
+ /// Checks if range B is fully contained by range A
+ let rangeContainsRange (a: range) (b: range) =
Position.posGeq b.Start a.Start && Position.posGeq a.End b.End
let rangeEq = Range.equals
- let isAdjacentTo (r1: Range) (r2: Range) : bool =
+ let isAdjacentTo (r1: range) (r2: range) : bool =
r1.FileName = r2.FileName
&& r1.End.Line = r2.Start.Line
&& r1.EndColumn = r2.StartColumn
diff --git a/src/Fantomas.Core/RangeHelpers.fsi b/src/Fantomas.Core/RangeHelpers.fsi
index 36033b7534..b5575bb36f 100644
--- a/src/Fantomas.Core/RangeHelpers.fsi
+++ b/src/Fantomas.Core/RangeHelpers.fsi
@@ -1,13 +1,13 @@
namespace Fantomas.Core
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
[]
module RangeHelpers =
/// Checks if Range B is fully contained by Range A
- val rangeContainsRange: a: Range -> b: Range -> bool
+ val rangeContainsRange: a: range -> b: range -> bool
val rangeEq: (range -> range -> bool)
- val isAdjacentTo: r1: Range -> r2: Range -> bool
+ val isAdjacentTo: r1: range -> r2: range -> bool
module RangePatterns =
val (|StartEndRange|): size: int -> range: range -> range * range * range
diff --git a/src/Fantomas.Core/Selection.fs b/src/Fantomas.Core/Selection.fs
index 9909d7ad00..c9a416d0ea 100644
--- a/src/Fantomas.Core/Selection.fs
+++ b/src/Fantomas.Core/Selection.fs
@@ -1,10 +1,9 @@
module internal Fantomas.Core.Selection
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
open Fantomas.Core.SyntaxOak
-open Fantomas.Core.ISourceTextExtensions
-let correctSelection (fileIndex: int) (sourceText: ISourceText) (selection: range) =
+let correctSelection (fileName: string) (sourceText: ISourceText) (selection: range) =
let lines =
[| selection.StartLine .. selection.EndLine |]
|> Array.choose (fun lineNumber ->
@@ -54,10 +53,7 @@ let correctSelection (fileIndex: int) (sourceText: ISourceText) (selection: rang
|| endColumn <> selection.EndColumn
then
- Range.mkFileIndexRange
- fileIndex
- (Position.mkPos startLineNumber startColumn)
- (Position.mkPos endLineNumber endColumn)
+ Range.mkRange fileName (Position.mkPos startLineNumber startColumn) (Position.mkPos endLineNumber endColumn)
else
selection
| _ -> selection
@@ -371,8 +367,7 @@ let formatSelection
(sourceText: ISourceText)
: Async =
async {
- let baseUntypedTree, baseDiagnostics =
- Fantomas.FCS.Parse.parseFile isSignature sourceText []
+ let baseUntypedTree, baseDiagnostics = Parse.parseFile isSignature sourceText []
let isValid = Validation.noWarningOrErrorDiagnostics baseDiagnostics
@@ -385,7 +380,7 @@ let formatSelection
printTriviaNode rootNode
#endif
- let selection = correctSelection rootNode.Range.FileIndex sourceText selection
+ let selection = correctSelection rootNode.Range.FileName sourceText selection
let treeWithSelection =
Trivia.findNodeWhereRangeFitsIn rootNode selection
@@ -421,14 +416,14 @@ let formatSelection
CodePrinter.genFile enrichedTree context |> Context.dump true
let source = SourceText.ofString formattedCode
- let formattedAST, _ = Fantomas.FCS.Parse.parseFile isSignature source []
+ let formattedAST, _ = Parse.parseFile isSignature source []
let formattedTree = ASTTransformer.mkOak (Some source) formattedAST
let rangeOfSelection = findRangeOf t formattedTree
match rangeOfSelection with
| None ->
raise (FormatException("No suitable AST node could be extracted from formatted selection."))
- | Some m -> source.GetContentAt m
+ | Some m -> source.GetSubTextFromRange m
return formattedSelection.TrimEnd([| '\r'; '\n' |]), selection
}
diff --git a/src/Fantomas.Core/Selection.fsi b/src/Fantomas.Core/Selection.fsi
index 834ab23294..dde98cd52f 100644
--- a/src/Fantomas.Core/Selection.fsi
+++ b/src/Fantomas.Core/Selection.fsi
@@ -1,6 +1,6 @@
module internal Fantomas.Core.Selection
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
val formatSelection:
config: FormatConfig -> isSignature: bool -> selection: range -> sourceText: ISourceText -> Async
diff --git a/src/Fantomas.Core/SyntaxOak.fs b/src/Fantomas.Core/SyntaxOak.fs
index d2cfb394b9..59546ca32c 100644
--- a/src/Fantomas.Core/SyntaxOak.fs
+++ b/src/Fantomas.Core/SyntaxOak.fs
@@ -1,7 +1,7 @@
module rec Fantomas.Core.SyntaxOak
open System.Collections.Generic
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
type TriviaContent =
| CommentOnSingleLine of string
@@ -91,7 +91,7 @@ let nodeRange (n: Node) = n.Range
let combineRanges (ranges: range seq) =
if Seq.isEmpty ranges then
- Range.Zero
+ Range.range0
else
Seq.reduce Range.unionRanges ranges
@@ -111,7 +111,7 @@ type IdentListNode(content: IdentifierOrDot list, range) =
inherit NodeBase(range)
member val IsEmpty = content.IsEmpty
member val Content = content
- static member Empty = IdentListNode(List.empty, Range.Zero)
+ static member Empty = IdentListNode(List.empty, Range.range0)
override x.Children =
x.Content
diff --git a/src/Fantomas.Core/Trivia.fs b/src/Fantomas.Core/Trivia.fs
index 229050708e..7c135cd94b 100644
--- a/src/Fantomas.Core/Trivia.fs
+++ b/src/Fantomas.Core/Trivia.fs
@@ -1,10 +1,8 @@
module internal Fantomas.Core.Trivia
-open System
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.SyntaxTrivia
-open Fantomas.FCS.Text
-open Fantomas.Core.ISourceTextExtensions
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.SyntaxTrivia
+open FSharp.Compiler.Text
open Fantomas.Core.SyntaxOak
type CommentTrivia with
@@ -23,7 +21,7 @@ let internal collectTriviaFromCodeComments
|> List.filter (fun ct -> RangeHelpers.rangeContainsRange codeRange ct.Range)
|> List.map (function
| CommentTrivia.BlockComment r ->
- let content = source.GetContentAt r
+ let content = source.GetSubTextFromRange r
let startLine = source.GetLineString(r.StartLine - 1)
let endLine = source.GetLineString(r.EndLine - 1)
@@ -40,7 +38,7 @@ let internal collectTriviaFromCodeComments
TriviaNode(content, r)
| CommentTrivia.LineComment r ->
- let content = source.GetContentAt r
+ let content = source.GetSubTextFromRange r
let index = r.StartLine - 1
let line = source.GetLineString index
@@ -67,8 +65,6 @@ let internal collectTriviaFromBlankLines
// weird edge cases where there is no source code but only hash defines
[]
else
- let fileIndex = codeRange.FileIndex
-
let captureLinesIfMultiline (r: range) =
if r.StartLine = r.EndLine then
[]
@@ -122,7 +118,7 @@ let internal collectTriviaFromBlankLines
else
let range =
let p = Position.mkPos (idx + 1) 0
- Range.mkFileIndexRange fileIndex p p
+ Range.mkRange codeRange.FileName p p
if count < config.KeepMaxNumberOfBlankLines then
(count + 1), Some(TriviaNode(Newline, range))
@@ -146,7 +142,7 @@ let internal collectTriviaFromDirectives
|> List.filter (fun cdt -> RangeHelpers.rangeContainsRange codeRange cdt.Range)
|> List.map (fun cdt ->
let m = cdt.Range
- let text = (source.GetContentAt m).TrimEnd()
+ let text = (source.GetSubTextFromRange m).TrimEnd()
let content = Directive text
TriviaNode(content, m))
@@ -349,7 +345,7 @@ let insertCursor (tree: Oak) (cursor: pos) =
let nodeWithCursor = findNodeWhereRangeFitsIn tree cursorRange
match nodeWithCursor with
- | Some((:? SingleTextNode) as node) -> node.AddCursor cursor
+ | Some(:? SingleTextNode as node) -> node.AddCursor cursor
| _ -> addToTree tree [| TriviaNode(TriviaContent.Cursor, cursorRange) |]
tree
diff --git a/src/Fantomas.Core/Trivia.fsi b/src/Fantomas.Core/Trivia.fsi
index ce6a0d7276..5ecb7272cb 100644
--- a/src/Fantomas.Core/Trivia.fsi
+++ b/src/Fantomas.Core/Trivia.fsi
@@ -1,7 +1,7 @@
module internal Fantomas.Core.Trivia
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.Text
+open FSharp.Compiler.Syntax
+open FSharp.Compiler.Text
open Fantomas.Core.SyntaxOak
val findNodeWhereRangeFitsIn: root: Node -> range: range -> Node option
diff --git a/src/Fantomas.Core/Validation.fs b/src/Fantomas.Core/Validation.fs
index 843b3b3205..54c00fec15 100644
--- a/src/Fantomas.Core/Validation.fs
+++ b/src/Fantomas.Core/Validation.fs
@@ -1,9 +1,8 @@
module internal Fantomas.Core.Validation
-open Fantomas.FCS.Diagnostics
-open Fantomas.FCS.Text
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.Parse
+open FSharp.Compiler.Diagnostics
+open FSharp.Compiler.Text
+open FSharp.Compiler.Syntax
// See https://github.com/dotnet/fsharp/blob/2a25184293e39a635217670652b00680de04472a/src/Compiler/Driver/CompilerDiagnostics.fs#L214
// and https://github.com/dotnet/fsharp/blob/b7e747921515ae7939c7cb6885513eb80ec7ca2f/src/Compiler/FSComp.txt
@@ -15,17 +14,14 @@ let safeToIgnoreWarnings =
46 // ReservedKeyword
1104 ] // lexhlpIdentifiersContainingAtSymbolReserved
-let noWarningOrErrorDiagnostics diagnostics =
+let noWarningOrErrorDiagnostics (diagnostics: FSharpDiagnostic list) =
diagnostics
|> List.filter (fun e ->
match e.Severity with
| FSharpDiagnosticSeverity.Error -> true
| FSharpDiagnosticSeverity.Hidden
| FSharpDiagnosticSeverity.Info -> false
- | FSharpDiagnosticSeverity.Warning ->
- match e.ErrorNumber with
- | None -> true
- | Some errorNumber -> not (safeToIgnoreWarnings.Contains(errorNumber)))
+ | FSharpDiagnosticSeverity.Warning -> not (safeToIgnoreWarnings.Contains(e.ErrorNumber)))
|> List.isEmpty
/// Check whether an input string is invalid in F# by looking for errors and warnings in the diagnostics.
@@ -33,7 +29,7 @@ let isValidFSharpCode (isSignature: bool) (source: string) : Async =
async {
// First get the syntax tree without any defines
let sourceText = SourceText.ofString source
- let baseUntypedTree, baseDiagnostics = parseFile isSignature sourceText []
+ let baseUntypedTree, baseDiagnostics = Parse.parseFile isSignature sourceText []
let hashDirectives =
match baseUntypedTree with
@@ -50,7 +46,7 @@ let isValidFSharpCode (isSignature: bool) (source: string) : Async =
let isValidForCombinations =
defineCombinations
|> List.map (fun defineCombination ->
- let _, diagnostics = parseFile isSignature sourceText defineCombination.Value
+ let _, diagnostics = Parse.parseFile isSignature sourceText defineCombination.Value
noWarningOrErrorDiagnostics diagnostics)
return Seq.forall id isValidForCombinations
diff --git a/src/Fantomas.Core/Validation.fsi b/src/Fantomas.Core/Validation.fsi
index 4b8d1c84ef..1f96f9d9a6 100644
--- a/src/Fantomas.Core/Validation.fsi
+++ b/src/Fantomas.Core/Validation.fsi
@@ -1,7 +1,7 @@
module internal Fantomas.Core.Validation
-open Fantomas.FCS.Parse
+open FSharp.Compiler.Diagnostics
-val noWarningOrErrorDiagnostics: diagnostics: FSharpParserDiagnostic list -> bool
+val noWarningOrErrorDiagnostics: diagnostics: FSharpDiagnostic list -> bool
/// Check whether an input string is invalid in F# by looking for errors and warnings in the diagnostics.
val isValidFSharpCode: isSignature: bool -> source: string -> Async
diff --git a/src/Fantomas.Core/packages.lock.json b/src/Fantomas.Core/packages.lock.json
index a7ea9cf3af..424793300e 100644
--- a/src/Fantomas.Core/packages.lock.json
+++ b/src/Fantomas.Core/packages.lock.json
@@ -25,9 +25,9 @@
},
"FSharp.Core": {
"type": "Direct",
- "requested": "[6.0.1, )",
- "resolved": "6.0.1",
- "contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
+ "requested": "[8.0.100, )",
+ "resolved": "8.0.100",
+ "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
@@ -63,13 +63,8 @@
},
"Microsoft.NETCore.Platforms": {
"type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "TMBuzAHpTenGbGgk0SMTwyEkyijY/Eae4ZGsFNYJvAr/LDn1ku3Etp3FPxChmDp5HHF3kzJuoaa08N0xjqAJfQ=="
- },
- "Microsoft.NETCore.Targets": {
- "type": "Transitive",
- "resolved": "1.1.3",
- "contentHash": "3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ=="
+ "resolved": "1.1.0",
+ "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A=="
},
"Microsoft.SourceLink.AzureRepos.Git": {
"type": "Transitive",
@@ -117,30 +112,75 @@
"resolved": "4.5.1",
"contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
+ "System.Collections.Immutable": {
+ "type": "Transitive",
+ "resolved": "7.0.0",
+ "contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==",
+ "dependencies": {
+ "System.Memory": "4.5.5",
+ "System.Runtime.CompilerServices.Unsafe": "6.0.0"
+ }
+ },
"System.Numerics.Vectors": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ=="
},
+ "System.Reflection.Emit": {
+ "type": "Transitive",
+ "resolved": "4.7.0",
+ "contentHash": "VR4kk8XLKebQ4MZuKuIni/7oh+QGFmZW3qORd1GvBq/8026OpW501SzT/oypwiQl4TvT8ErnReh/NzY9u+C6wQ==",
+ "dependencies": {
+ "System.Reflection.Emit.ILGeneration": "4.7.0"
+ }
+ },
+ "System.Reflection.Emit.ILGeneration": {
+ "type": "Transitive",
+ "resolved": "4.7.0",
+ "contentHash": "AucBYo3DSI0IDxdUjKksBcQJXPHyoPyrCXYURW1WDsLI4M65Ar/goSHjdnHOAY9MiYDNKqDlIgaYm+zL2hA1KA=="
+ },
+ "System.Reflection.Metadata": {
+ "type": "Transitive",
+ "resolved": "7.0.0",
+ "contentHash": "MclTG61lsD9sYdpNz9xsKBzjsmsfCtcMZYXz/IUr2zlhaTaABonlr1ESeompTgM+Xk+IwtGYU7/voh3YWB/fWw==",
+ "dependencies": {
+ "System.Collections.Immutable": "7.0.0",
+ "System.Memory": "4.5.5"
+ }
+ },
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
- "fantomas.fcs": {
+ "fsharp.compiler.service": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "System.Diagnostics.DiagnosticSource": "[7.0.0, )",
+ "FSharp.Core": "[8.0.100, )",
+ "FSharp.DependencyManager.Nuget": "[8.0.200, )",
+ "System.Buffers": "[4.5.1, )",
+ "System.Collections.Immutable": "[7.0.0, )",
+ "System.Diagnostics.DiagnosticSource": "[7.0.2, )",
"System.Memory": "[4.5.5, )",
- "System.Runtime": "[4.3.1, )"
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
+ }
+ },
+ "fsharp.dependencymanager.nuget": {
+ "type": "Project",
+ "dependencies": {
+ "FSharp.Core": "[8.0.100, )",
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
}
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
- "resolved": "7.0.0",
- "contentHash": "9W0ewWDuAyDqS2PigdTxk6jDKonfgscY/hP8hm7VpxYhNHZHKvZTdRckberlFk3VnCmr3xBUyMBut12Q+T2aOw==",
+ "resolved": "7.0.2",
+ "contentHash": "hYr3I9N9811e0Bjf2WNwAGGyTuAFbbTgX1RPLt/3Wbm68x3IGcX5Cl75CMmgT6WlNwLQ2tCCWfqYPpypjaf2xA==",
"dependencies": {
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
@@ -156,16 +196,6 @@
"System.Numerics.Vectors": "4.4.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
}
- },
- "System.Runtime": {
- "type": "CentralTransitive",
- "requested": "[4.3.1, )",
- "resolved": "4.3.1",
- "contentHash": "abhfv1dTK6NXOmu4bgHIONxHyEqFjW8HwXPmpY9gmll+ix9UNo4XDcmzJn6oLooftxNssVHdJC1pGT9jkSynQg==",
- "dependencies": {
- "Microsoft.NETCore.Platforms": "1.1.1",
- "Microsoft.NETCore.Targets": "1.1.3"
- }
}
}
}
diff --git a/src/Fantomas.FCS/AssemblyInfo.fs b/src/Fantomas.FCS/AssemblyInfo.fs
deleted file mode 100644
index 137e6d6230..0000000000
--- a/src/Fantomas.FCS/AssemblyInfo.fs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace System
-
-open System.Runtime.CompilerServices
-
-[]
-[]
-[]
-[]
-[]
-[]
-
-do ()
diff --git a/src/Fantomas.FCS/Fantomas.FCS.fsproj b/src/Fantomas.FCS/Fantomas.FCS.fsproj
deleted file mode 100644
index 14380a72fd..0000000000
--- a/src/Fantomas.FCS/Fantomas.FCS.fsproj
+++ /dev/null
@@ -1,315 +0,0 @@
-
-
-
- netstandard2.0
- true
- $(NoWarn);57;
- $(NoWarn);1204
- $(DefineConstants);COMPILER;FSHARPCORE_USE_PACKAGE
- generated\$(TargetFramework)\
- generated\$(TargetFramework)\
- true
- true
- true
-
-
-
-
-
- FSComp.txt
-
-
- FSStrings.resx
- FSStrings.resources
-
-
- Utilities\Activity.fsi
-
-
- Utilities\Activity.fs
-
-
- Utilities\sformat.fsi
-
-
- Utilities\sformat.fs
-
-
- Utilities\sr.fsi
-
-
- Utilities\sr.fs
-
-
- Utilities\ResizeArray.fsi
-
-
- Utilities\ResizeArray.fs
-
-
- Utilities\HashMultiMap.fsi
-
-
- Utilities\HashMultiMap.fs
-
-
- Utilities\TaggedCollections.fsi
-
-
- Utilities\TaggedCollections.fs
-
-
- Utilities\illib.fsi
-
-
- Utilities\illib.fs
-
-
- Utilities\Cancellable.fsi
-
-
- Utilities\Cancellable.fs
-
-
- Utilities\FileSystem.fsi
-
-
- Utilities\FileSystem.fs
-
-
- Utilities\ildiag.fsi
-
-
- Utilities\ildiag.fs
-
-
- Utilities\zmap.fsi
-
-
- Utilities\zmap.fs
-
-
- Utilities\zset.fsi
-
-
- Utilities\zset.fs
-
-
- Utilities\XmlAdapters.fsi
-
-
- Utilities\XmlAdapters.fs
-
-
- Utilities\InternalCollections.fsi
-
-
- Utilities\InternalCollections.fs
-
-
- Utilities\lib.fsi
-
-
- Utilities\lib.fs
-
-
- Utilities\PathMap.fsi
-
-
- Utilities\PathMap.fs
-
-
- Utilities\range.fsi
-
-
- Utilities\range.fs
-
-
- Facilities\LanguageFeatures.fsi
-
-
- Facilities\LanguageFeatures.fs
-
-
- Facilities\DiagnosticOptions.fsi
-
-
- Facilities\DiagnosticOptions.fs
-
-
- Facilities\DiagnosticsLogger.fsi
-
-
- Facilities\DiagnosticsLogger.fs
-
-
- Facilities\prim-lexing.fsi
-
-
- Facilities\prim-lexing.fs
-
-
- Facilities\prim-parsing.fsi
-
-
- Facilities\prim-parsing.fs
-
-
- --module Fantomas.FCS.AbstractIL.AsciiLexer --internal --open Internal.Utilities.Text.Lexing --open Fantomas.FCS.AbstractIL.AsciiParser --unicode --lexlib Internal.Utilities.Text.Lexing
- AbstractIL\illex.fsl
-
-
- AbstractIL\illex.fsl
-
-
- --module Fantomas.FCS.AbstractIL.AsciiParser --open Fantomas.FCS.AbstractIL --open Fantomas.FCS.AbstractIL.AsciiConstants --open Fantomas.FCS.AbstractIL.IL --internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing --buffer-type-argument char
- AbstractIL\ilpars.fsy
-
-
- AbstractIL\FsYacc\ilpars.fsy
-
-
- AbstractIL\il.fsi
-
-
- AbstractIL\il.fs
-
-
- AbstractIL\ilascii.fsi
-
-
- AbstractIL\ilascii.fs
-
-
- AbstractIL\FsYaccOut\ilpars.fsi
-
-
- AbstractIL\FsYaccOut\ilpars.fs
-
-
- AbstractIL\FsLexOut\illex.fsi
-
-
- AbstractIL\FsLexOut\illex.fs
-
-
- SyntaxTree\PrettyNaming.fsi
-
-
- SyntaxTree\PrettyNaming.fs
-
-
- --module Fantomas.FCS.PPLexer --internal --open Fantomas.FCS.Lexhelp --open Internal.Utilities.Text.Lexing --open Fantomas.FCS.PPParser --unicode --lexlib Internal.Utilities.Text.Lexing
- SyntaxTree\pplex.fsl
-
-
- --module Fantomas.FCS.PPParser --open Fantomas.FCS --open Fantomas.FCS.Syntax --open Fantomas.FCS.ParseHelpers --internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing --buffer-type-argument char
- SyntaxTree\pppars.fsy
-
-
- --module Fantomas.FCS.Lexer --open Fantomas.FCS.Lexhelp --open Internal.Utilities.Text.Lexing --open Fantomas.FCS.Parser --open Fantomas.FCS.Text --open Fantomas.FCS.ParseHelpers --internal --unicode --lexlib Internal.Utilities.Text.Lexing
- SyntaxTree\lex.fsl
-
-
- -v --module Fantomas.FCS.Parser --open Fantomas.FCS --open Fantomas.FCS.Syntax --open Fantomas.FCS.Text --internal --lexlib Internal.Utilities.Text.Lexing --parslib Internal.Utilities.Text.Parsing --buffer-type-argument char
- SyntaxTree\pars.fsy
-
-
- SyntaxTree\FsLex\pplex.fsl
-
-
- SyntaxTree\FsLex\lex.fsl
-
-
- SyntaxTree\FsYacc\pppars.fsy
-
-
- SyntaxTree\FsYacc\pars.fsy
-
-
- SyntaxTree\UnicodeLexing.fsi
-
-
- SyntaxTree\UnicodeLexing.fs
-
-
- SyntaxTree\XmlDoc.fsi
-
-
- SyntaxTree\XmlDoc.fs
-
-
- SyntaxTree\SyntaxTrivia.fsi
-
-
- SyntaxTree\SyntaxTrivia.fs
-
-
- SyntaxTree\SyntaxTree.fsi
-
-
- SyntaxTree\SyntaxTree.fs
-
-
- SyntaxTree\SyntaxTreeOps.fsi
-
-
- SyntaxTree\SyntaxTreeOps.fs
-
-
- SyntaxTree\ParseHelpers.fsi
-
-
- SyntaxTree\ParseHelpers.fs
-
-
- SyntaxTree\FsYaccOutput\pppars.fsi
-
-
- SyntaxTree\FsYaccOutput\pppars.fs
-
-
- SyntaxTree\FsYaccOutput\pars.fsi
-
-
- SyntaxTree\FsYaccOutput\pars.fs
-
-
- SyntaxTree\LexHelpers.fsi
-
-
- SyntaxTree\LexHelpers.fs
-
-
- SyntaxTree\FsLexOutput\pplex.fsi
-
-
- SyntaxTree\FsLexOutput\pplex.fs
-
-
- SyntaxTree\FsLexOutput\lex.fsi
-
-
- SyntaxTree\FsLexOutput\lex.fs
-
-
- SyntaxTree\LexFilter.fsi
-
-
- SyntaxTree\LexFilter.fs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Fantomas.FCS/Parse.fs b/src/Fantomas.FCS/Parse.fs
deleted file mode 100644
index e95dcea013..0000000000
--- a/src/Fantomas.FCS/Parse.fs
+++ /dev/null
@@ -1,1070 +0,0 @@
-module Fantomas.FCS.Parse
-
-open System
-open System.Text
-open System.Diagnostics
-open Fantomas.FCS.Diagnostics
-open Fantomas.FCS.DiagnosticMessage
-open Internal.Utilities
-open Internal.Utilities.Library
-open Fantomas.FCS
-open Fantomas.FCS.AbstractIL.IL
-open Fantomas.FCS.DiagnosticsLogger
-open Fantomas.FCS.Features
-open Fantomas.FCS.Lexhelp
-open Fantomas.FCS.Text
-open Fantomas.FCS.Text.Position
-open Fantomas.FCS.Text.Range
-open Fantomas.FCS.Xml
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.SyntaxTrivia
-open Fantomas.FCS.Syntax.PrettyNaming
-open Fantomas.FCS.SyntaxTreeOps
-open Fantomas.FCS.IO
-open Fantomas.FCS.ParseHelpers
-
-let FSharpSigFileSuffixes = [ ".mli"; ".fsi" ]
-
-let mlCompatSuffixes = [ ".mli"; ".ml" ]
-
-let FSharpImplFileSuffixes = [ ".ml"; ".fs"; ".fsscript"; ".fsx" ]
-
-let FSharpScriptFileSuffixes = [ ".fsscript"; ".fsx" ]
-
-let CanonicalizeFilename filename =
- let basic = FileSystemUtils.fileNameOfPath filename
-
- String.capitalize (
- try
- FileSystemUtils.chopExtension basic
- with _ ->
- basic
- )
-
-let ComputeAnonModuleName check defaultNamespace filename (m: range) =
- let modname = CanonicalizeFilename filename
-
- if
- check
- && not (modname |> String.forall (fun c -> Char.IsLetterOrDigit c || c = '_'))
- then
- if
- not (
- filename.EndsWith("fsx", StringComparison.OrdinalIgnoreCase)
- || filename.EndsWith("fsscript", StringComparison.OrdinalIgnoreCase)
- )
- then
- warning (
- Error(
- FSComp.SR.buildImplicitModuleIsNotLegalIdentifier (
- modname,
- (FileSystemUtils.fileNameOfPath filename)
- ),
- m
- )
- )
-
- let combined =
- match defaultNamespace with
- | None -> modname
- | Some ns -> textOfPath [ ns; modname ]
-
- let anonymousModuleNameRange =
- let filename = m.FileName
- mkRange filename pos0 pos0
-
- pathToSynLid anonymousModuleNameRange (splitNamespace combined)
-
-let IsScript filename =
- let lower = String.lowercase filename
- FSharpScriptFileSuffixes |> List.exists (FileSystemUtils.checkSuffix lower)
-
-let PostParseModuleImpl (_i, defaultNamespace, _isLastCompiland, filename, impl) =
- match impl with
- | ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(lid,
- isRec,
- kind,
- decls,
- xmlDoc,
- attribs,
- access,
- m,
- trivia)) ->
- let lid =
- match lid with
- | [ id ] when kind.IsModule && id.idText = MangledGlobalName ->
- error (Error(FSComp.SR.buildInvalidModuleOrNamespaceName (), id.idRange))
- | id :: rest when id.idText = MangledGlobalName -> rest
- | _ -> lid
-
- SynModuleOrNamespace(lid, isRec, kind, decls, xmlDoc, attribs, access, m, trivia)
-
- | ParsedImplFileFragment.AnonModule(defs, m) ->
- let modname =
- ComputeAnonModuleName (not (isNil defs)) defaultNamespace filename (trimRangeToLine m)
-
- let trivia: SynModuleOrNamespaceTrivia =
- { LeadingKeyword = SynModuleOrNamespaceLeadingKeyword.None }
-
- SynModuleOrNamespace(
- modname,
- false,
- SynModuleOrNamespaceKind.AnonModule,
- defs,
- PreXmlDoc.Empty,
- [],
- None,
- m,
- trivia
- )
-
- | ParsedImplFileFragment.NamespaceFragment(lid, isRecursive, kind, decls, xmlDoc, attributes, range, trivia) ->
- let lid, kind =
- match lid with
- | id :: rest when id.idText = MangledGlobalName ->
- rest,
- if List.isEmpty rest then
- SynModuleOrNamespaceKind.GlobalNamespace
- else
- kind
- | _ -> lid, kind
-
- SynModuleOrNamespace(lid, isRecursive, kind, decls, xmlDoc, attributes, None, range, trivia)
-
-// Give a unique name to the different kinds of inputs. Used to correlate signature and implementation files
-// QualFileNameOfModuleName - files with a single module declaration or an anonymous module
-let QualFileNameOfModuleName m filename modname =
- QualifiedNameOfFile(mkSynId m (textOfLid modname + (if IsScript filename then "$fsx" else "")))
-
-let QualFileNameOfFilename m filename =
- QualifiedNameOfFile(mkSynId m (CanonicalizeFilename filename + (if IsScript filename then "$fsx" else "")))
-
-let QualFileNameOfSpecs filename specs =
- match specs with
- | [ SynModuleOrNamespaceSig(longId = modname; kind = kind; range = m) ] when kind.IsModule ->
- QualFileNameOfModuleName m filename modname
- | [ SynModuleOrNamespaceSig(kind = kind; range = m) ] when not kind.IsModule -> QualFileNameOfFilename m filename
- | _ -> QualFileNameOfFilename (mkRange filename pos0 pos0) filename
-
-let QualFileNameOfImpls filename specs =
- match specs with
- | [ SynModuleOrNamespace(longId = modname; kind = kind; range = m) ] when kind.IsModule ->
- QualFileNameOfModuleName m filename modname
- | [ SynModuleOrNamespace(kind = kind; range = m) ] when not kind.IsModule -> QualFileNameOfFilename m filename
- | _ -> QualFileNameOfFilename (mkRange filename pos0 pos0) filename
-
-let GetScopedPragmasForInput input =
- match input with
- | ParsedInput.SigFile(ParsedSigFileInput(scopedPragmas = pragmas)) -> pragmas
- | ParsedInput.ImplFile(ParsedImplFileInput(scopedPragmas = pragmas)) -> pragmas
-
-let collectCodeComments (lexbuf: UnicodeLexing.Lexbuf) (tripleSlashComments: range list) =
- [ yield! LexbufCommentStore.GetComments(lexbuf)
- yield! (List.map CommentTrivia.LineComment tripleSlashComments) ]
- |> List.sortBy (function
- | CommentTrivia.LineComment r
- | CommentTrivia.BlockComment r -> r.StartLine, r.StartColumn)
-
-let PostParseModuleImpls
- (
- defaultNamespace,
- filename,
- isLastCompiland,
- ParsedImplFile(hashDirectives, impls),
- lexbuf: UnicodeLexing.Lexbuf,
- tripleSlashComments: range list
- ) =
- match
- impls
- |> List.rev
- |> List.tryPick (function
- | ParsedImplFileFragment.NamedModule(SynModuleOrNamespace(longId = lid)) -> Some lid
- | _ -> None)
- with
- | Some lid when impls.Length > 1 -> errorR (Error(FSComp.SR.buildMultipleToplevelModules (), rangeOfLid lid))
- | _ -> ()
-
- let impls =
- impls
- |> List.mapi (fun i x -> PostParseModuleImpl(i, defaultNamespace, isLastCompiland, filename, x))
-
- let qualName = QualFileNameOfImpls filename impls
- let isScript = IsScript filename
-
- let scopedPragmas = []
- let conditionalDirectives = LexbufIfdefStore.GetTrivia(lexbuf)
- let codeComments = collectCodeComments lexbuf tripleSlashComments
-
- ParsedInput.ImplFile(
- ParsedImplFileInput(
- filename,
- isScript,
- qualName,
- scopedPragmas,
- hashDirectives,
- impls,
- isLastCompiland,
- { ConditionalDirectives = conditionalDirectives
- CodeComments = codeComments },
- Set.empty
- )
- )
-
-let PostParseModuleSpec (_i, defaultNamespace, _isLastCompiland, filename, intf) =
- match intf with
- | ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(lid,
- isRec,
- kind,
- decls,
- xmlDoc,
- attribs,
- access,
- m,
- trivia)) ->
- let lid =
- match lid with
- | [ id ] when kind.IsModule && id.idText = MangledGlobalName ->
- error (Error(FSComp.SR.buildInvalidModuleOrNamespaceName (), id.idRange))
- | id :: rest when id.idText = MangledGlobalName -> rest
- | _ -> lid
-
- SynModuleOrNamespaceSig(
- lid,
- isRec,
- SynModuleOrNamespaceKind.NamedModule,
- decls,
- xmlDoc,
- attribs,
- access,
- m,
- trivia
- )
-
- | ParsedSigFileFragment.AnonModule(defs, m) ->
- let modname =
- ComputeAnonModuleName (not (isNil defs)) defaultNamespace filename (trimRangeToLine m)
-
- let trivia: SynModuleOrNamespaceSigTrivia =
- { LeadingKeyword = SynModuleOrNamespaceLeadingKeyword.None }
-
- SynModuleOrNamespaceSig(
- modname,
- false,
- SynModuleOrNamespaceKind.AnonModule,
- defs,
- PreXmlDoc.Empty,
- [],
- None,
- m,
- trivia
- )
-
- | ParsedSigFileFragment.NamespaceFragment(lid, isRecursive, kind, decls, xmlDoc, attributes, range, trivia) ->
- let lid, kind =
- match lid with
- | id :: rest when id.idText = MangledGlobalName ->
- rest,
- if List.isEmpty rest then
- SynModuleOrNamespaceKind.GlobalNamespace
- else
- kind
- | _ -> lid, kind
-
- SynModuleOrNamespaceSig(lid, isRecursive, kind, decls, xmlDoc, attributes, None, range, trivia)
-
-let PostParseModuleSpecs
- (
- defaultNamespace,
- filename,
- isLastCompiland,
- ParsedSigFile(hashDirectives, specs),
- lexbuf: UnicodeLexing.Lexbuf,
- tripleSlashComments: range list
- ) =
- match
- specs
- |> List.rev
- |> List.tryPick (function
- | ParsedSigFileFragment.NamedModule(SynModuleOrNamespaceSig(longId = lid)) -> Some lid
- | _ -> None)
- with
- | Some lid when specs.Length > 1 -> errorR (Error(FSComp.SR.buildMultipleToplevelModules (), rangeOfLid lid))
- | _ -> ()
-
- let specs =
- specs
- |> List.mapi (fun i x -> PostParseModuleSpec(i, defaultNamespace, isLastCompiland, filename, x))
-
- let qualName = QualFileNameOfSpecs filename specs
- let scopedPragmas = []
-
- let conditionalDirectives = LexbufIfdefStore.GetTrivia(lexbuf)
- let codeComments = collectCodeComments lexbuf tripleSlashComments
-
- ParsedInput.SigFile(
- ParsedSigFileInput(
- filename,
- qualName,
- scopedPragmas,
- hashDirectives,
- specs,
- { ConditionalDirectives = conditionalDirectives
- CodeComments = codeComments },
- Set.empty
- )
- )
-
-let ParseInput
- (
- lexer,
- errorLogger: CapturingDiagnosticsLogger,
- lexbuf: UnicodeLexing.Lexbuf,
- defaultNamespace,
- filename,
- isLastCompiland
- ) =
- // The assert below is almost ok, but it fires in two cases:
- // - fsi.exe sometimes passes "stdin" as a dummy filename
- // - if you have a #line directive, e.g.
- // # 1000 "Line01.fs"
- // then it also asserts. But these are edge cases that can be fixed later, e.g. in bug 4651.
- //System.Diagnostics.Debug.Assert(System.IO.Path.IsPathRooted filename, sprintf "should be absolute: '%s'" filename)
- let lower = String.lowercase filename
-
- // Delay sending errors and warnings until after the file is parsed. This gives us a chance to scrape the
- // #nowarn declarations for the file
- let delayLogger = CapturingDiagnosticsLogger("Parsing")
- use _ = UseDiagnosticsLogger delayLogger
- use _ = UseBuildPhase BuildPhase.Parse
-
- let mutable scopedPragmas = []
-
- try
- let input =
- if mlCompatSuffixes |> List.exists (FileSystemUtils.checkSuffix lower) then
- if lexbuf.SupportsFeature LanguageFeature.MLCompatRevisions then
- errorR (Error(FSComp.SR.buildInvalidSourceFileExtensionML filename, rangeStartup))
- else
- mlCompatWarning (FSComp.SR.buildCompilingExtensionIsForML ()) rangeStartup
-
- // Call the appropriate parser - for signature files or implementation files
- if FSharpImplFileSuffixes |> List.exists (FileSystemUtils.checkSuffix lower) then
- let impl = Parser.implementationFile lexer lexbuf
-
- let tripleSlashComments =
- LexbufLocalXmlDocStore.ReportInvalidXmlDocPositions(lexbuf)
-
- PostParseModuleImpls(defaultNamespace, filename, isLastCompiland, impl, lexbuf, tripleSlashComments)
- elif FSharpSigFileSuffixes |> List.exists (FileSystemUtils.checkSuffix lower) then
- let intfs = Parser.signatureFile lexer lexbuf
-
- let tripleSlashComments =
- LexbufLocalXmlDocStore.ReportInvalidXmlDocPositions(lexbuf)
-
- PostParseModuleSpecs(defaultNamespace, filename, isLastCompiland, intfs, lexbuf, tripleSlashComments)
- else if lexbuf.SupportsFeature LanguageFeature.MLCompatRevisions then
- error (Error(FSComp.SR.buildInvalidSourceFileExtensionUpdated filename, rangeStartup))
- else
- error (Error(FSComp.SR.buildInvalidSourceFileExtension filename, rangeStartup))
-
- scopedPragmas <- GetScopedPragmasForInput input
- input
- finally
- // OK, now commit the errors, since the ScopedPragmas will (hopefully) have been scraped
- let filteringErrorLogger = errorLogger // TODO: does this matter? //GetErrorLoggerFilteringByScopedPragmas(false, scopedPragmas, diagnosticOptions, errorLogger)
- delayLogger.CommitDelayedDiagnostics filteringErrorLogger
-
-let EmptyParsedInput (filename, isLastCompiland) =
- let lower = String.lowercase filename
-
- if FSharpSigFileSuffixes |> List.exists (FileSystemUtils.checkSuffix lower) then
- ParsedInput.SigFile(
- ParsedSigFileInput(
- filename,
- QualFileNameOfImpls filename [],
- [],
- [],
- [],
- { ConditionalDirectives = []
- CodeComments = [] },
- Set.empty
- )
- )
- else
- ParsedInput.ImplFile(
- ParsedImplFileInput(
- filename,
- false,
- QualFileNameOfImpls filename [],
- [],
- [],
- [],
- isLastCompiland,
- { ConditionalDirectives = []
- CodeComments = [] },
- Set.empty
- )
- )
-
-let createLexbuf langVersion sourceText =
- UnicodeLexing.SourceTextAsLexbuf(true, LanguageVersion(langVersion), Some true, sourceText)
-
-let createLexerFunction (defines: string list) lexbuf (errorLogger: CapturingDiagnosticsLogger) =
- let lightStatus = IndentationAwareSyntaxStatus(true, true)
-
- // Note: we don't really attempt to intern strings across a large scope.
- let lexResourceManager = LexResourceManager()
-
- let lexargs =
- mkLexargs (defines, lightStatus, lexResourceManager, [], errorLogger, PathMap.empty, false)
-
- let lexargs =
- { lexargs with
- applyLineDirectives = false }
-
- let compilingFsLib = false
-
- let tokenizer =
- LexFilter.LexFilter(lightStatus, compilingFsLib, Lexer.token lexargs true, lexbuf, false)
-
- (fun _ -> tokenizer.GetToken())
-
-type FSharpParserDiagnostic =
- { Severity: FSharpDiagnosticSeverity
- SubCategory: string
- Range: range option
- // GetDiagnosticNumber from dotnet/fsharp/src/fsharp/CompilerDiagnostics.fs
- ErrorNumber: int option
- Message: string }
-
-let getErrorString key = SR.GetString key
-
-let UnexpectedEndOfInputE () =
- DeclareResourceString("UnexpectedEndOfInput", "")
-
-let OBlockEndSentenceE () =
- DeclareResourceString("BlockEndSentence", "")
-
-let UnexpectedE () =
- DeclareResourceString("Unexpected", "%s")
-
-let NONTERM_interactionE () =
- DeclareResourceString("NONTERM.interaction", "")
-
-let NONTERM_hashDirectiveE () =
- DeclareResourceString("NONTERM.hashDirective", "")
-
-let NONTERM_fieldDeclE () =
- DeclareResourceString("NONTERM.fieldDecl", "")
-
-let NONTERM_unionCaseReprE () =
- DeclareResourceString("NONTERM.unionCaseRepr", "")
-
-let NONTERM_localBindingE () =
- DeclareResourceString("NONTERM.localBinding", "")
-
-let NONTERM_hardwhiteLetBindingsE () =
- DeclareResourceString("NONTERM.hardwhiteLetBindings", "")
-
-let NONTERM_classDefnMemberE () =
- DeclareResourceString("NONTERM.classDefnMember", "")
-
-let NONTERM_defnBindingsE () =
- DeclareResourceString("NONTERM.defnBindings", "")
-
-let NONTERM_classMemberSpfnE () =
- DeclareResourceString("NONTERM.classMemberSpfn", "")
-
-let NONTERM_valSpfnE () =
- DeclareResourceString("NONTERM.valSpfn", "")
-
-let NONTERM_tyconSpfnE () =
- DeclareResourceString("NONTERM.tyconSpfn", "")
-
-let NONTERM_anonLambdaExprE () =
- DeclareResourceString("NONTERM.anonLambdaExpr", "")
-
-let NONTERM_attrUnionCaseDeclE () =
- DeclareResourceString("NONTERM.attrUnionCaseDecl", "")
-
-let NONTERM_cPrototypeE () =
- DeclareResourceString("NONTERM.cPrototype", "")
-
-let NONTERM_objectImplementationMembersE () =
- DeclareResourceString("NONTERM.objectImplementationMembers", "")
-
-let NONTERM_ifExprCasesE () =
- DeclareResourceString("NONTERM.ifExprCases", "")
-
-let NONTERM_openDeclE () =
- DeclareResourceString("NONTERM.openDecl", "")
-
-let NONTERM_fileModuleSpecE () =
- DeclareResourceString("NONTERM.fileModuleSpec", "")
-
-let NONTERM_patternClausesE () =
- DeclareResourceString("NONTERM.patternClauses", "")
-
-let NONTERM_beginEndExprE () =
- DeclareResourceString("NONTERM.beginEndExpr", "")
-
-let NONTERM_recdExprE () =
- DeclareResourceString("NONTERM.recdExpr", "")
-
-let NONTERM_tyconDefnE () =
- DeclareResourceString("NONTERM.tyconDefn", "")
-
-let NONTERM_exconCoreE () =
- DeclareResourceString("NONTERM.exconCore", "")
-
-let NONTERM_typeNameInfoE () =
- DeclareResourceString("NONTERM.typeNameInfo", "")
-
-let NONTERM_attributeListE () =
- DeclareResourceString("NONTERM.attributeList", "")
-
-let NONTERM_quoteExprE () =
- DeclareResourceString("NONTERM.quoteExpr", "")
-
-let NONTERM_typeConstraintE () =
- DeclareResourceString("NONTERM.typeConstraint", "")
-
-let NONTERM_Category_ImplementationFileE () =
- DeclareResourceString("NONTERM.Category.ImplementationFile", "")
-
-let NONTERM_Category_DefinitionE () =
- DeclareResourceString("NONTERM.Category.Definition", "")
-
-let NONTERM_Category_SignatureFileE () =
- DeclareResourceString("NONTERM.Category.SignatureFile", "")
-
-let NONTERM_Category_PatternE () =
- DeclareResourceString("NONTERM.Category.Pattern", "")
-
-let NONTERM_Category_ExprE () =
- DeclareResourceString("NONTERM.Category.Expr", "")
-
-let NONTERM_Category_TypeE () =
- DeclareResourceString("NONTERM.Category.Type", "")
-
-let NONTERM_typeArgsActualE () =
- DeclareResourceString("NONTERM.typeArgsActual", "")
-
-let TokenName1E () =
- DeclareResourceString("TokenName1", "%s")
-
-let TokenName1TokenName2E () =
- DeclareResourceString("TokenName1TokenName2", "%s%s")
-
-let TokenName1TokenName2TokenName3E () =
- DeclareResourceString("TokenName1TokenName2TokenName3", "%s%s%s")
-
-let LibraryUseOnlyE () =
- DeclareResourceString("LibraryUseOnly", "")
-
-let getSyntaxErrorMessage ctxt =
- let ctxt =
- unbox> ctxt
-
- let os = StringBuilder()
-
- let (|EndOfStructuredConstructToken|_|) token =
- match token with
- | Parser.TOKEN_ODECLEND
- | Parser.TOKEN_OBLOCKSEP
- | Parser.TOKEN_OEND
- | Parser.TOKEN_ORIGHT_BLOCK_END
- | Parser.TOKEN_OBLOCKEND
- | Parser.TOKEN_OBLOCKEND_COMING_SOON
- | Parser.TOKEN_OBLOCKEND_IS_HERE -> Some()
- | _ -> None
-
- let tokenIdToText tid =
- match tid with
- | Parser.TOKEN_IDENT -> getErrorString "Parser.TOKEN.IDENT"
- | Parser.TOKEN_BIGNUM
- | Parser.TOKEN_INT8
- | Parser.TOKEN_UINT8
- | Parser.TOKEN_INT16
- | Parser.TOKEN_UINT16
- | Parser.TOKEN_INT32
- | Parser.TOKEN_UINT32
- | Parser.TOKEN_INT64
- | Parser.TOKEN_UINT64
- | Parser.TOKEN_UNATIVEINT
- | Parser.TOKEN_NATIVEINT -> getErrorString "Parser.TOKEN.INT"
- | Parser.TOKEN_IEEE32
- | Parser.TOKEN_IEEE64 -> getErrorString "Parser.TOKEN.FLOAT"
- | Parser.TOKEN_DECIMAL -> getErrorString "Parser.TOKEN.DECIMAL"
- | Parser.TOKEN_CHAR -> getErrorString "Parser.TOKEN.CHAR"
-
- | Parser.TOKEN_BASE -> getErrorString "Parser.TOKEN.BASE"
- | Parser.TOKEN_LPAREN_STAR_RPAREN -> getErrorString "Parser.TOKEN.LPAREN.STAR.RPAREN"
- | Parser.TOKEN_DOLLAR -> getErrorString "Parser.TOKEN.DOLLAR"
- | Parser.TOKEN_INFIX_STAR_STAR_OP -> getErrorString "Parser.TOKEN.INFIX.STAR.STAR.OP"
- | Parser.TOKEN_INFIX_COMPARE_OP -> getErrorString "Parser.TOKEN.INFIX.COMPARE.OP"
- | Parser.TOKEN_COLON_GREATER -> getErrorString "Parser.TOKEN.COLON.GREATER"
- | Parser.TOKEN_COLON_COLON -> getErrorString "Parser.TOKEN.COLON.COLON"
- | Parser.TOKEN_PERCENT_OP -> getErrorString "Parser.TOKEN.PERCENT.OP"
- | Parser.TOKEN_INFIX_AT_HAT_OP -> getErrorString "Parser.TOKEN.INFIX.AT.HAT.OP"
- | Parser.TOKEN_INFIX_BAR_OP -> getErrorString "Parser.TOKEN.INFIX.BAR.OP"
- | Parser.TOKEN_PLUS_MINUS_OP -> getErrorString "Parser.TOKEN.PLUS.MINUS.OP"
- | Parser.TOKEN_PREFIX_OP -> getErrorString "Parser.TOKEN.PREFIX.OP"
- | Parser.TOKEN_COLON_QMARK_GREATER -> getErrorString "Parser.TOKEN.COLON.QMARK.GREATER"
- | Parser.TOKEN_INFIX_STAR_DIV_MOD_OP -> getErrorString "Parser.TOKEN.INFIX.STAR.DIV.MOD.OP"
- | Parser.TOKEN_INFIX_AMP_OP -> getErrorString "Parser.TOKEN.INFIX.AMP.OP"
- | Parser.TOKEN_AMP -> getErrorString "Parser.TOKEN.AMP"
- | Parser.TOKEN_AMP_AMP -> getErrorString "Parser.TOKEN.AMP.AMP"
- | Parser.TOKEN_BAR_BAR -> getErrorString "Parser.TOKEN.BAR.BAR"
- | Parser.TOKEN_LESS -> getErrorString "Parser.TOKEN.LESS"
- | Parser.TOKEN_GREATER -> getErrorString "Parser.TOKEN.GREATER"
- | Parser.TOKEN_QMARK -> getErrorString "Parser.TOKEN.QMARK"
- | Parser.TOKEN_QMARK_QMARK -> getErrorString "Parser.TOKEN.QMARK.QMARK"
- | Parser.TOKEN_COLON_QMARK -> getErrorString "Parser.TOKEN.COLON.QMARK"
- | Parser.TOKEN_INT32_DOT_DOT -> getErrorString "Parser.TOKEN.INT32.DOT.DOT"
- | Parser.TOKEN_DOT_DOT -> getErrorString "Parser.TOKEN.DOT.DOT"
- | Parser.TOKEN_DOT_DOT_HAT -> getErrorString "Parser.TOKEN.DOT.DOT"
- | Parser.TOKEN_QUOTE -> getErrorString "Parser.TOKEN.QUOTE"
- | Parser.TOKEN_STAR -> getErrorString "Parser.TOKEN.STAR"
- | Parser.TOKEN_HIGH_PRECEDENCE_TYAPP -> getErrorString "Parser.TOKEN.HIGH.PRECEDENCE.TYAPP"
- | Parser.TOKEN_COLON -> getErrorString "Parser.TOKEN.COLON"
- | Parser.TOKEN_COLON_EQUALS -> getErrorString "Parser.TOKEN.COLON.EQUALS"
- | Parser.TOKEN_LARROW -> getErrorString "Parser.TOKEN.LARROW"
- | Parser.TOKEN_EQUALS -> getErrorString "Parser.TOKEN.EQUALS"
- | Parser.TOKEN_GREATER_BAR_RBRACK -> getErrorString "Parser.TOKEN.GREATER.BAR.RBRACK"
- | Parser.TOKEN_MINUS -> getErrorString "Parser.TOKEN.MINUS"
- | Parser.TOKEN_ADJACENT_PREFIX_OP -> getErrorString "Parser.TOKEN.ADJACENT.PREFIX.OP"
- | Parser.TOKEN_FUNKY_OPERATOR_NAME -> getErrorString "Parser.TOKEN.FUNKY.OPERATOR.NAME"
- | Parser.TOKEN_COMMA -> getErrorString "Parser.TOKEN.COMMA"
- | Parser.TOKEN_DOT -> getErrorString "Parser.TOKEN.DOT"
- | Parser.TOKEN_BAR -> getErrorString "Parser.TOKEN.BAR"
- | Parser.TOKEN_HASH -> getErrorString "Parser.TOKEN.HASH"
- | Parser.TOKEN_UNDERSCORE -> getErrorString "Parser.TOKEN.UNDERSCORE"
- | Parser.TOKEN_SEMICOLON -> getErrorString "Parser.TOKEN.SEMICOLON"
- | Parser.TOKEN_SEMICOLON_SEMICOLON -> getErrorString "Parser.TOKEN.SEMICOLON.SEMICOLON"
- | Parser.TOKEN_LPAREN -> getErrorString "Parser.TOKEN.LPAREN"
- | Parser.TOKEN_RPAREN
- | Parser.TOKEN_RPAREN_COMING_SOON
- | Parser.TOKEN_RPAREN_IS_HERE -> getErrorString "Parser.TOKEN.RPAREN"
- | Parser.TOKEN_LQUOTE -> getErrorString "Parser.TOKEN.LQUOTE"
- | Parser.TOKEN_LBRACK -> getErrorString "Parser.TOKEN.LBRACK"
- | Parser.TOKEN_LBRACE_BAR -> getErrorString "Parser.TOKEN.LBRACE.BAR"
- | Parser.TOKEN_LBRACK_BAR -> getErrorString "Parser.TOKEN.LBRACK.BAR"
- | Parser.TOKEN_LBRACK_LESS -> getErrorString "Parser.TOKEN.LBRACK.LESS"
- | Parser.TOKEN_LBRACE -> getErrorString "Parser.TOKEN.LBRACE"
- | Parser.TOKEN_BAR_RBRACK -> getErrorString "Parser.TOKEN.BAR.RBRACK"
- | Parser.TOKEN_BAR_RBRACE -> getErrorString "Parser.TOKEN.BAR.RBRACE"
- | Parser.TOKEN_GREATER_RBRACK -> getErrorString "Parser.TOKEN.GREATER.RBRACK"
- | Parser.TOKEN_RQUOTE_DOT
- | Parser.TOKEN_RQUOTE -> getErrorString "Parser.TOKEN.RQUOTE"
- | Parser.TOKEN_RBRACK -> getErrorString "Parser.TOKEN.RBRACK"
- | Parser.TOKEN_RBRACE
- | Parser.TOKEN_RBRACE_COMING_SOON
- | Parser.TOKEN_RBRACE_IS_HERE -> getErrorString "Parser.TOKEN.RBRACE"
- | Parser.TOKEN_PUBLIC -> getErrorString "Parser.TOKEN.PUBLIC"
- | Parser.TOKEN_PRIVATE -> getErrorString "Parser.TOKEN.PRIVATE"
- | Parser.TOKEN_INTERNAL -> getErrorString "Parser.TOKEN.INTERNAL"
- | Parser.TOKEN_CONSTRAINT -> getErrorString "Parser.TOKEN.CONSTRAINT"
- | Parser.TOKEN_INSTANCE -> getErrorString "Parser.TOKEN.INSTANCE"
- | Parser.TOKEN_DELEGATE -> getErrorString "Parser.TOKEN.DELEGATE"
- | Parser.TOKEN_INHERIT -> getErrorString "Parser.TOKEN.INHERIT"
- | Parser.TOKEN_CONSTRUCTOR -> getErrorString "Parser.TOKEN.CONSTRUCTOR"
- | Parser.TOKEN_DEFAULT -> getErrorString "Parser.TOKEN.DEFAULT"
- | Parser.TOKEN_OVERRIDE -> getErrorString "Parser.TOKEN.OVERRIDE"
- | Parser.TOKEN_ABSTRACT -> getErrorString "Parser.TOKEN.ABSTRACT"
- | Parser.TOKEN_CLASS -> getErrorString "Parser.TOKEN.CLASS"
- | Parser.TOKEN_MEMBER -> getErrorString "Parser.TOKEN.MEMBER"
- | Parser.TOKEN_STATIC -> getErrorString "Parser.TOKEN.STATIC"
- | Parser.TOKEN_NAMESPACE -> getErrorString "Parser.TOKEN.NAMESPACE"
- | Parser.TOKEN_OBLOCKBEGIN -> getErrorString "Parser.TOKEN.OBLOCKBEGIN"
- | EndOfStructuredConstructToken -> getErrorString "Parser.TOKEN.OBLOCKEND"
- | Parser.TOKEN_THEN
- | Parser.TOKEN_OTHEN -> getErrorString "Parser.TOKEN.OTHEN"
- | Parser.TOKEN_ELSE
- | Parser.TOKEN_OELSE -> getErrorString "Parser.TOKEN.OELSE"
- | Parser.TOKEN_LET
- | Parser.TOKEN_OLET -> getErrorString "Parser.TOKEN.OLET"
- | Parser.TOKEN_OBINDER
- | Parser.TOKEN_BINDER -> getErrorString "Parser.TOKEN.BINDER"
- | Parser.TOKEN_OAND_BANG
- | Parser.TOKEN_AND_BANG -> getErrorString "Parser.TOKEN.AND.BANG"
- | Parser.TOKEN_ODO -> getErrorString "Parser.TOKEN.ODO"
- | Parser.TOKEN_OWITH -> getErrorString "Parser.TOKEN.OWITH"
- | Parser.TOKEN_OFUNCTION -> getErrorString "Parser.TOKEN.OFUNCTION"
- | Parser.TOKEN_OFUN -> getErrorString "Parser.TOKEN.OFUN"
- | Parser.TOKEN_ORESET -> getErrorString "Parser.TOKEN.ORESET"
- | Parser.TOKEN_ODUMMY -> getErrorString "Parser.TOKEN.ODUMMY"
- | Parser.TOKEN_DO_BANG
- | Parser.TOKEN_ODO_BANG -> getErrorString "Parser.TOKEN.ODO.BANG"
- | Parser.TOKEN_YIELD -> getErrorString "Parser.TOKEN.YIELD"
- | Parser.TOKEN_YIELD_BANG -> getErrorString "Parser.TOKEN.YIELD.BANG"
- | Parser.TOKEN_OINTERFACE_MEMBER -> getErrorString "Parser.TOKEN.OINTERFACE.MEMBER"
- | Parser.TOKEN_ELIF -> getErrorString "Parser.TOKEN.ELIF"
- | Parser.TOKEN_RARROW -> getErrorString "Parser.TOKEN.RARROW"
- | Parser.TOKEN_SIG -> getErrorString "Parser.TOKEN.SIG"
- | Parser.TOKEN_STRUCT -> getErrorString "Parser.TOKEN.STRUCT"
- | Parser.TOKEN_UPCAST -> getErrorString "Parser.TOKEN.UPCAST"
- | Parser.TOKEN_DOWNCAST -> getErrorString "Parser.TOKEN.DOWNCAST"
- | Parser.TOKEN_NULL -> getErrorString "Parser.TOKEN.NULL"
- | Parser.TOKEN_RESERVED -> getErrorString "Parser.TOKEN.RESERVED"
- | Parser.TOKEN_MODULE
- | Parser.TOKEN_MODULE_COMING_SOON
- | Parser.TOKEN_MODULE_IS_HERE -> getErrorString "Parser.TOKEN.MODULE"
- | Parser.TOKEN_AND -> getErrorString "Parser.TOKEN.AND"
- | Parser.TOKEN_AS -> getErrorString "Parser.TOKEN.AS"
- | Parser.TOKEN_ASSERT -> getErrorString "Parser.TOKEN.ASSERT"
- | Parser.TOKEN_OASSERT -> getErrorString "Parser.TOKEN.ASSERT"
- | Parser.TOKEN_ASR -> getErrorString "Parser.TOKEN.ASR"
- | Parser.TOKEN_DOWNTO -> getErrorString "Parser.TOKEN.DOWNTO"
- | Parser.TOKEN_EXCEPTION -> getErrorString "Parser.TOKEN.EXCEPTION"
- | Parser.TOKEN_FALSE -> getErrorString "Parser.TOKEN.FALSE"
- | Parser.TOKEN_FOR -> getErrorString "Parser.TOKEN.FOR"
- | Parser.TOKEN_FUN -> getErrorString "Parser.TOKEN.FUN"
- | Parser.TOKEN_FUNCTION -> getErrorString "Parser.TOKEN.FUNCTION"
- | Parser.TOKEN_FINALLY -> getErrorString "Parser.TOKEN.FINALLY"
- | Parser.TOKEN_LAZY -> getErrorString "Parser.TOKEN.LAZY"
- | Parser.TOKEN_OLAZY -> getErrorString "Parser.TOKEN.LAZY"
- | Parser.TOKEN_MATCH -> getErrorString "Parser.TOKEN.MATCH"
- | Parser.TOKEN_MATCH_BANG -> getErrorString "Parser.TOKEN.MATCH.BANG"
- | Parser.TOKEN_MUTABLE -> getErrorString "Parser.TOKEN.MUTABLE"
- | Parser.TOKEN_NEW -> getErrorString "Parser.TOKEN.NEW"
- | Parser.TOKEN_OF -> getErrorString "Parser.TOKEN.OF"
- | Parser.TOKEN_OPEN -> getErrorString "Parser.TOKEN.OPEN"
- | Parser.TOKEN_OR -> getErrorString "Parser.TOKEN.OR"
- | Parser.TOKEN_VOID -> getErrorString "Parser.TOKEN.VOID"
- | Parser.TOKEN_EXTERN -> getErrorString "Parser.TOKEN.EXTERN"
- | Parser.TOKEN_INTERFACE -> getErrorString "Parser.TOKEN.INTERFACE"
- | Parser.TOKEN_REC -> getErrorString "Parser.TOKEN.REC"
- | Parser.TOKEN_TO -> getErrorString "Parser.TOKEN.TO"
- | Parser.TOKEN_TRUE -> getErrorString "Parser.TOKEN.TRUE"
- | Parser.TOKEN_TRY -> getErrorString "Parser.TOKEN.TRY"
- | Parser.TOKEN_TYPE
- | Parser.TOKEN_TYPE_COMING_SOON
- | Parser.TOKEN_TYPE_IS_HERE -> getErrorString "Parser.TOKEN.TYPE"
- | Parser.TOKEN_VAL -> getErrorString "Parser.TOKEN.VAL"
- | Parser.TOKEN_INLINE -> getErrorString "Parser.TOKEN.INLINE"
- | Parser.TOKEN_WHEN -> getErrorString "Parser.TOKEN.WHEN"
- | Parser.TOKEN_WHILE -> getErrorString "Parser.TOKEN.WHILE"
- | Parser.TOKEN_WHILE_BANG -> getErrorString "Parser.TOKEN.WHILE.BANG"
- | Parser.TOKEN_WITH -> getErrorString "Parser.TOKEN.WITH"
- | Parser.TOKEN_IF -> getErrorString "Parser.TOKEN.IF"
- | Parser.TOKEN_DO -> getErrorString "Parser.TOKEN.DO"
- | Parser.TOKEN_GLOBAL -> getErrorString "Parser.TOKEN.GLOBAL"
- | Parser.TOKEN_DONE -> getErrorString "Parser.TOKEN.DONE"
- | Parser.TOKEN_IN
- | Parser.TOKEN_JOIN_IN -> getErrorString "Parser.TOKEN.IN"
- | Parser.TOKEN_HIGH_PRECEDENCE_PAREN_APP -> getErrorString "Parser.TOKEN.HIGH.PRECEDENCE.PAREN.APP"
- | Parser.TOKEN_HIGH_PRECEDENCE_BRACK_APP -> getErrorString "Parser.TOKEN.HIGH.PRECEDENCE.BRACK.APP"
- | Parser.TOKEN_BEGIN -> getErrorString "Parser.TOKEN.BEGIN"
- | Parser.TOKEN_END -> getErrorString "Parser.TOKEN.END"
- | Parser.TOKEN_HASH_LIGHT
- | Parser.TOKEN_HASH_LINE
- | Parser.TOKEN_HASH_IF
- | Parser.TOKEN_HASH_ELSE
- | Parser.TOKEN_HASH_ENDIF -> getErrorString "Parser.TOKEN.HASH.ENDIF"
- | Parser.TOKEN_INACTIVECODE -> getErrorString "Parser.TOKEN.INACTIVECODE"
- | Parser.TOKEN_LEX_FAILURE -> getErrorString "Parser.TOKEN.LEX.FAILURE"
- | Parser.TOKEN_WHITESPACE -> getErrorString "Parser.TOKEN.WHITESPACE"
- | Parser.TOKEN_COMMENT -> getErrorString "Parser.TOKEN.COMMENT"
- | Parser.TOKEN_LINE_COMMENT -> getErrorString "Parser.TOKEN.LINE.COMMENT"
- | Parser.TOKEN_STRING_TEXT -> getErrorString "Parser.TOKEN.STRING.TEXT"
- | Parser.TOKEN_BYTEARRAY -> getErrorString "Parser.TOKEN.BYTEARRAY"
- | Parser.TOKEN_STRING -> getErrorString "Parser.TOKEN.STRING"
- | Parser.TOKEN_KEYWORD_STRING -> getErrorString "Parser.TOKEN.KEYWORD_STRING"
- | Parser.TOKEN_EOF -> getErrorString "Parser.TOKEN.EOF"
- | Parser.TOKEN_CONST -> getErrorString "Parser.TOKEN.CONST"
- | Parser.TOKEN_FIXED -> getErrorString "Parser.TOKEN.FIXED"
- | Parser.TOKEN_INTERP_STRING_BEGIN_END -> getErrorString "Parser.TOKEN.INTERP.STRING.BEGIN.END"
- | Parser.TOKEN_INTERP_STRING_BEGIN_PART -> getErrorString "Parser.TOKEN.INTERP.STRING.BEGIN.PART"
- | Parser.TOKEN_INTERP_STRING_PART -> getErrorString "Parser.TOKEN.INTERP.STRING.PART"
- | Parser.TOKEN_INTERP_STRING_END -> getErrorString "Parser.TOKEN.INTERP.STRING.END"
- | unknown ->
- Debug.Assert(false, "unknown token tag")
- let result = $"%+A{unknown}"
- Debug.Assert(false, result)
- result
-
- match ctxt.CurrentToken with
- | None -> os.Append(UnexpectedEndOfInputE().Format) |> ignore
- | Some token ->
- match (token |> Parser.tagOfToken |> Parser.tokenTagToTokenId), token with
- | EndOfStructuredConstructToken, _ -> os.Append(OBlockEndSentenceE().Format) |> ignore
- | Parser.TOKEN_LEX_FAILURE, Parser.LEX_FAILURE str -> Printf.bprintf os $"%s{str}" (* Fix bug://2431 *)
- | token, _ -> os.Append(UnexpectedE().Format(token |> tokenIdToText)) |> ignore
-
- (* Search for a state producing a single recognized non-terminal in the states on the stack *)
- let foundInContext =
-
- (* Merge a bunch of expression non terminals *)
- let (|NONTERM_Category_Expr|_|) =
- function
- | Parser.NONTERM_argExpr
- | Parser.NONTERM_minusExpr
- | Parser.NONTERM_parenExpr
- | Parser.NONTERM_atomicExpr
- | Parser.NONTERM_appExpr
- | Parser.NONTERM_tupleExpr
- | Parser.NONTERM_declExpr
- | Parser.NONTERM_braceExpr
- | Parser.NONTERM_braceBarExpr
- | Parser.NONTERM_typedSequentialExprBlock
- | Parser.NONTERM_interactiveExpr -> Some()
- | _ -> None
-
- (* Merge a bunch of pattern non terminals *)
- let (|NONTERM_Category_Pattern|_|) =
- function
- | Parser.NONTERM_constrPattern
- | Parser.NONTERM_parenPattern
- | Parser.NONTERM_atomicPattern -> Some()
- | _ -> None
-
- (* Merge a bunch of if/then/else non terminals *)
- let (|NONTERM_Category_IfThenElse|_|) =
- function
- | Parser.NONTERM_ifExprThen
- | Parser.NONTERM_ifExprElifs
- | Parser.NONTERM_ifExprCases -> Some()
- | _ -> None
-
- (* Merge a bunch of non terminals *)
- let (|NONTERM_Category_SignatureFile|_|) =
- function
- | Parser.NONTERM_signatureFile
- | Parser.NONTERM_moduleSpfn
- | Parser.NONTERM_moduleSpfns -> Some()
- | _ -> None
-
- let (|NONTERM_Category_ImplementationFile|_|) =
- function
- | Parser.NONTERM_implementationFile
- | Parser.NONTERM_fileNamespaceImpl
- | Parser.NONTERM_fileNamespaceImpls -> Some()
- | _ -> None
-
- let (|NONTERM_Category_Definition|_|) =
- function
- | Parser.NONTERM_fileModuleImpl
- | Parser.NONTERM_moduleDefn
- | Parser.NONTERM_interactiveDefns
- | Parser.NONTERM_moduleDefns
- | Parser.NONTERM_moduleDefnsOrExpr -> Some()
- | _ -> None
-
- let (|NONTERM_Category_Type|_|) =
- function
- | Parser.NONTERM_typ
- | Parser.NONTERM_tupleType -> Some()
- | _ -> None
-
- let (|NONTERM_Category_Interaction|_|) =
- function
- | Parser.NONTERM_interactiveItemsTerminator
- | Parser.NONTERM_interaction
- | Parser.NONTERM__startinteraction -> Some()
- | _ -> None
-
- // Canonicalize the categories and check for a unique category
- ctxt.ReducibleProductions
- |> List.exists (fun prods ->
- match
- prods
- |> List.map Parser.prodIdxToNonTerminal
- |> List.map (function
- | NONTERM_Category_Type -> Parser.NONTERM_typ
- | NONTERM_Category_Expr -> Parser.NONTERM_declExpr
- | NONTERM_Category_Pattern -> Parser.NONTERM_atomicPattern
- | NONTERM_Category_IfThenElse -> Parser.NONTERM_ifExprThen
- | NONTERM_Category_SignatureFile -> Parser.NONTERM_signatureFile
- | NONTERM_Category_ImplementationFile -> Parser.NONTERM_implementationFile
- | NONTERM_Category_Definition -> Parser.NONTERM_moduleDefn
- | NONTERM_Category_Interaction -> Parser.NONTERM_interaction
- | nt -> nt)
- |> Set.ofList
- |> Set.toList
- with
- | [ Parser.NONTERM_interaction ] ->
- os.Append(NONTERM_interactionE().Format) |> ignore
- true
- | [ Parser.NONTERM_hashDirective ] ->
- os.Append(NONTERM_hashDirectiveE().Format) |> ignore
- true
- | [ Parser.NONTERM_fieldDecl ] ->
- os.Append(NONTERM_fieldDeclE().Format) |> ignore
- true
- | [ Parser.NONTERM_unionCaseRepr ] ->
- os.Append(NONTERM_unionCaseReprE().Format) |> ignore
- true
- | [ Parser.NONTERM_localBinding ] ->
- os.Append(NONTERM_localBindingE().Format) |> ignore
- true
- | [ Parser.NONTERM_hardwhiteLetBindings ] ->
- os.Append(NONTERM_hardwhiteLetBindingsE().Format) |> ignore
- true
- | [ Parser.NONTERM_classDefnMember ] ->
- os.Append(NONTERM_classDefnMemberE().Format) |> ignore
- true
- | [ Parser.NONTERM_defnBindings ] ->
- os.Append(NONTERM_defnBindingsE().Format) |> ignore
- true
- | [ Parser.NONTERM_classMemberSpfn ] ->
- os.Append(NONTERM_classMemberSpfnE().Format) |> ignore
- true
- | [ Parser.NONTERM_valSpfn ] ->
- os.Append(NONTERM_valSpfnE().Format) |> ignore
- true
- | [ Parser.NONTERM_tyconSpfn ] ->
- os.Append(NONTERM_tyconSpfnE().Format) |> ignore
- true
- | [ Parser.NONTERM_anonLambdaExpr ] ->
- os.Append(NONTERM_anonLambdaExprE().Format) |> ignore
- true
- | [ Parser.NONTERM_attrUnionCaseDecl ] ->
- os.Append(NONTERM_attrUnionCaseDeclE().Format) |> ignore
- true
- | [ Parser.NONTERM_cPrototype ] ->
- os.Append(NONTERM_cPrototypeE().Format) |> ignore
- true
- | [ Parser.NONTERM_objExpr | Parser.NONTERM_objectImplementationMembers ] ->
- os.Append(NONTERM_objectImplementationMembersE().Format) |> ignore
- true
- | [ Parser.NONTERM_ifExprThen | Parser.NONTERM_ifExprElifs | Parser.NONTERM_ifExprCases ] ->
- os.Append(NONTERM_ifExprCasesE().Format) |> ignore
- true
- | [ Parser.NONTERM_openDecl ] ->
- os.Append(NONTERM_openDeclE().Format) |> ignore
- true
- | [ Parser.NONTERM_fileModuleSpec ] ->
- os.Append(NONTERM_fileModuleSpecE().Format) |> ignore
- true
- | [ Parser.NONTERM_patternClauses ] ->
- os.Append(NONTERM_patternClausesE().Format) |> ignore
- true
- | [ Parser.NONTERM_beginEndExpr ] ->
- os.Append(NONTERM_beginEndExprE().Format) |> ignore
- true
- | [ Parser.NONTERM_recdExpr ] ->
- os.Append(NONTERM_recdExprE().Format) |> ignore
- true
- | [ Parser.NONTERM_tyconDefn ] ->
- os.Append(NONTERM_tyconDefnE().Format) |> ignore
- true
- | [ Parser.NONTERM_exconCore ] ->
- os.Append(NONTERM_exconCoreE().Format) |> ignore
- true
- | [ Parser.NONTERM_typeNameInfo ] ->
- os.Append(NONTERM_typeNameInfoE().Format) |> ignore
- true
- | [ Parser.NONTERM_attributeList ] ->
- os.Append(NONTERM_attributeListE().Format) |> ignore
- true
- | [ Parser.NONTERM_quoteExpr ] ->
- os.Append(NONTERM_quoteExprE().Format) |> ignore
- true
- | [ Parser.NONTERM_typeConstraint ] ->
- os.Append(NONTERM_typeConstraintE().Format) |> ignore
- true
- | [ NONTERM_Category_ImplementationFile ] ->
- os.Append(NONTERM_Category_ImplementationFileE().Format) |> ignore
- true
- | [ NONTERM_Category_Definition ] ->
- os.Append(NONTERM_Category_DefinitionE().Format) |> ignore
- true
- | [ NONTERM_Category_SignatureFile ] ->
- os.Append(NONTERM_Category_SignatureFileE().Format) |> ignore
- true
- | [ NONTERM_Category_Pattern ] ->
- os.Append(NONTERM_Category_PatternE().Format) |> ignore
- true
- | [ NONTERM_Category_Expr ] ->
- os.Append(NONTERM_Category_ExprE().Format) |> ignore
- true
- | [ NONTERM_Category_Type ] ->
- os.Append(NONTERM_Category_TypeE().Format) |> ignore
- true
- | [ Parser.NONTERM_typeArgsActual ] ->
- os.Append(NONTERM_typeArgsActualE().Format) |> ignore
- true
- | _ -> false)
-
-#if DEBUG
- if not foundInContext then
- Printf.bprintf
- os
- $". (no 'in' context found: %+A{List.map (List.map Parser.prodIdxToNonTerminal) ctxt.ReducibleProductions})"
-#else
- foundInContext |> ignore // suppress unused variable warning in RELEASE
-#endif
- let fix (s: string) =
- s
- .Replace(SR.GetString("FixKeyword"), "")
- .Replace(SR.GetString("FixSymbol"), "")
- .Replace(SR.GetString("FixReplace"), "")
-
- match
- (ctxt.ShiftTokens
- |> List.map Parser.tokenTagToTokenId
- |> List.filter (function
- | Parser.TOKEN_error
- | Parser.TOKEN_EOF -> false
- | _ -> true)
- |> List.map tokenIdToText
- |> Set.ofList
- |> Set.toList)
- with
- | [ tokenName1 ] -> os.Append(TokenName1E().Format(fix tokenName1)) |> ignore
- | [ tokenName1; tokenName2 ] ->
- os.Append(TokenName1TokenName2E().Format (fix tokenName1) (fix tokenName2))
- |> ignore
- | [ tokenName1; tokenName2; tokenName3 ] ->
- os.Append(TokenName1TokenName2TokenName3E().Format (fix tokenName1) (fix tokenName2) (fix tokenName3))
- |> ignore
- | _ -> ()
-
- os.ToString()
-
-let parseFile
- (isSignature: bool)
- (sourceText: ISourceText)
- (defines: string list)
- : ParsedInput * FSharpParserDiagnostic list =
- let errorLogger = CapturingDiagnosticsLogger("ErrorHandler")
-
- let parseResult =
- let fileName = if isSignature then "tmp.fsi" else "tmp.fsx"
-
- usingLexbufForParsing (createLexbuf "preview" sourceText, fileName) (fun lexbuf ->
-
- let lexfun = createLexerFunction defines lexbuf errorLogger
- // both don't matter for Fantomas
- let isLastCompiland = false
- let isExe = false
-
- try
- ParseInput(lexfun, errorLogger, lexbuf, None, fileName, (isLastCompiland, isExe))
- with e ->
- errorLogger.StopProcessingRecovery e range0 // don't re-raise any exceptions, we must return None.
- EmptyParsedInput(fileName, (isLastCompiland, isExe)))
-
- let diagnostics =
- List.map
- (fun (p, severity) ->
- // See https://github.com/dotnet/fsharp/blob/2a25184293e39a635217670652b00680de04472a/src/Compiler/Driver/CompilerDiagnostics.fs#L214
- // for the error codes
- let range, message, errorNumber =
- match p.Exception with
- | :? IndentationProblem as ip -> Some ip.Data1, ip.Data0, Some 58
- | :? SyntaxError as se -> Some se.range, (getSyntaxErrorMessage se.Data0), Some 10
- | :? LibraryUseOnly as luo -> Some luo.range, LibraryUseOnlyE().Format, Some 42
- | :? DiagnosticWithText as dwt -> Some dwt.range, dwt.message, Some dwt.number
- | :? ReservedKeyword as rkw -> Some rkw.Data1, rkw.Data0, Some 46
- | _ -> None, p.Exception.Message, None
-
- { Severity = severity
- SubCategory = "parse"
- Range = range
- ErrorNumber = errorNumber
- Message = message })
- errorLogger.Diagnostics
-
- parseResult, diagnostics
diff --git a/src/Fantomas.FCS/Parse.fsi b/src/Fantomas.FCS/Parse.fsi
deleted file mode 100644
index 31b7aded9b..0000000000
--- a/src/Fantomas.FCS/Parse.fsi
+++ /dev/null
@@ -1,15 +0,0 @@
-module Fantomas.FCS.Parse
-
-open Fantomas.FCS.Diagnostics
-open Fantomas.FCS.Syntax
-open Fantomas.FCS.Text
-
-type FSharpParserDiagnostic =
- { Severity: FSharpDiagnosticSeverity
- SubCategory: string
- Range: range option
- ErrorNumber: int option
- Message: string }
-
-val parseFile:
- isSignature: bool -> sourceText: ISourceText -> defines: string list -> ParsedInput * FSharpParserDiagnostic list
diff --git a/src/Fantomas.FCS/packages.lock.json b/src/Fantomas.FCS/packages.lock.json
deleted file mode 100644
index b1069eca18..0000000000
--- a/src/Fantomas.FCS/packages.lock.json
+++ /dev/null
@@ -1,181 +0,0 @@
-{
- "version": 2,
- "dependencies": {
- ".NETStandard,Version=v2.0": {
- "DotNet.ReproducibleBuilds": {
- "type": "Direct",
- "requested": "[1.1.1, )",
- "resolved": "1.1.1",
- "contentHash": "+H2t/t34h6mhEoUvHi8yGXyuZ2GjSovcGYehJrS2MDm2XgmPfZL2Sdxg+uL2lKgZ4M6tTwKHIlxOob2bgh0NRQ==",
- "dependencies": {
- "Microsoft.SourceLink.AzureRepos.Git": "1.1.1",
- "Microsoft.SourceLink.Bitbucket.Git": "1.1.1",
- "Microsoft.SourceLink.GitHub": "1.1.1",
- "Microsoft.SourceLink.GitLab": "1.1.1"
- }
- },
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.2.0, )",
- "resolved": "0.2.0",
- "contentHash": "kF931CJ2QLMGDYNLnfi2uLlwotF72MXAYmFE5/0TVmYDUFJ9lZpQhQ1GlmgvVGZjvjWdnfmWAZjqkXlF7+dSHw==",
- "dependencies": {
- "NETStandard.Library": "1.6.1"
- }
- },
- "FSharp.Core": {
- "type": "Direct",
- "requested": "[6.0.1, )",
- "resolved": "6.0.1",
- "contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
- },
- "FsLexYacc": {
- "type": "Direct",
- "requested": "[11.2.0, )",
- "resolved": "11.2.0",
- "contentHash": "YfCWpEr1z34mtfBLINYLndmsUTLgADnwY1j1WibS1EbuGVVX9r6pkdqmN8/vWqBi5qvY/s7pBjdq51Ks1Dk5MQ==",
- "dependencies": {
- "FSharp.Core": "4.6.2",
- "FsLexYacc.Runtime": "11.2.0"
- }
- },
- "G-Research.FSharp.Analyzers": {
- "type": "Direct",
- "requested": "[0.6.0, )",
- "resolved": "0.6.0",
- "contentHash": "1ORjhbCk27Viafx3rUvK2wvql8+wzq7r4+eQti707xVO8By3C6NQJZbudjleHsXhYHimFxv30H7iwU4LpTIH4Q=="
- },
- "Ionide.Analyzers": {
- "type": "Direct",
- "requested": "[0.6.0, )",
- "resolved": "0.6.0",
- "contentHash": "+CRVPqW00m8nPguCDLtkZC4c3TmCtiO0V4T1z7HAV7T5ed1cucIIqUGtkan6EA17rjomrJ8vtz54KRT1pAT5dA=="
- },
- "Ionide.KeepAChangelog.Tasks": {
- "type": "Direct",
- "requested": "[0.1.8, )",
- "resolved": "0.1.8",
- "contentHash": "hHUZIVz9BlF++B5w183c5HwbqSIXUtJU+lxhKz3ebQ5X8INBIWV7dS/FK8uSqSMUTYavuKkRRTZvJlbYXPUykg=="
- },
- "NETStandard.Library": {
- "type": "Direct",
- "requested": "[2.0.3, )",
- "resolved": "2.0.3",
- "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
- "dependencies": {
- "Microsoft.NETCore.Platforms": "1.1.0"
- }
- },
- "System.Diagnostics.DiagnosticSource": {
- "type": "Direct",
- "requested": "[7.0.0, )",
- "resolved": "7.0.0",
- "contentHash": "9W0ewWDuAyDqS2PigdTxk6jDKonfgscY/hP8hm7VpxYhNHZHKvZTdRckberlFk3VnCmr3xBUyMBut12Q+T2aOw==",
- "dependencies": {
- "System.Memory": "4.5.5",
- "System.Runtime.CompilerServices.Unsafe": "6.0.0"
- }
- },
- "System.Memory": {
- "type": "Direct",
- "requested": "[4.5.5, )",
- "resolved": "4.5.5",
- "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
- "dependencies": {
- "System.Buffers": "4.5.1",
- "System.Numerics.Vectors": "4.4.0",
- "System.Runtime.CompilerServices.Unsafe": "4.5.3"
- }
- },
- "System.Runtime": {
- "type": "Direct",
- "requested": "[4.3.1, )",
- "resolved": "4.3.1",
- "contentHash": "abhfv1dTK6NXOmu4bgHIONxHyEqFjW8HwXPmpY9gmll+ix9UNo4XDcmzJn6oLooftxNssVHdJC1pGT9jkSynQg==",
- "dependencies": {
- "Microsoft.NETCore.Platforms": "1.1.1",
- "Microsoft.NETCore.Targets": "1.1.3"
- }
- },
- "FsLexYacc.Runtime": {
- "type": "Transitive",
- "resolved": "11.2.0",
- "contentHash": "psv1xPIm2NOEdd1RfaBSnN7y6M7XRS69QYB2kP2hD8LKaepGIGM5qAC7xHNpqO1v7QfyMFmuZ5/KqyWhfAfKJg==",
- "dependencies": {
- "FSharp.Core": "4.6.2"
- }
- },
- "Microsoft.Build.Tasks.Git": {
- "type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "AT3HlgTjsqHnWpBHSNeR0KxbLZD7bztlZVj7I8vgeYG9SYqbeFGh0TM/KVtC6fg53nrWHl3VfZFvb5BiQFcY6Q=="
- },
- "Microsoft.NETCore.Platforms": {
- "type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "TMBuzAHpTenGbGgk0SMTwyEkyijY/Eae4ZGsFNYJvAr/LDn1ku3Etp3FPxChmDp5HHF3kzJuoaa08N0xjqAJfQ=="
- },
- "Microsoft.NETCore.Targets": {
- "type": "Transitive",
- "resolved": "1.1.3",
- "contentHash": "3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ=="
- },
- "Microsoft.SourceLink.AzureRepos.Git": {
- "type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "qB5urvw9LO2bG3eVAkuL+2ughxz2rR7aYgm2iyrB8Rlk9cp2ndvGRCvehk3rNIhRuNtQaeKwctOl1KvWiklv5w==",
- "dependencies": {
- "Microsoft.Build.Tasks.Git": "1.1.1",
- "Microsoft.SourceLink.Common": "1.1.1"
- }
- },
- "Microsoft.SourceLink.Bitbucket.Git": {
- "type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "cDzxXwlyWpLWaH0em4Idj0H3AmVo3L/6xRXKssYemx+7W52iNskj/SQ4FOmfCb8YQt39otTDNMveCZzYtMoucQ==",
- "dependencies": {
- "Microsoft.Build.Tasks.Git": "1.1.1",
- "Microsoft.SourceLink.Common": "1.1.1"
- }
- },
- "Microsoft.SourceLink.Common": {
- "type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "WMcGpWKrmJmzrNeuaEb23bEMnbtR/vLmvZtkAP5qWu7vQsY59GqfRJd65sFpBszbd2k/bQ8cs8eWawQKAabkVg=="
- },
- "Microsoft.SourceLink.GitHub": {
- "type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "IaJGnOv/M7UQjRJks7B6p7pbPnOwisYGOIzqCz5ilGFTApZ3ktOR+6zJ12ZRPInulBmdAf1SrGdDG2MU8g6XTw==",
- "dependencies": {
- "Microsoft.Build.Tasks.Git": "1.1.1",
- "Microsoft.SourceLink.Common": "1.1.1"
- }
- },
- "Microsoft.SourceLink.GitLab": {
- "type": "Transitive",
- "resolved": "1.1.1",
- "contentHash": "tvsg47DDLqqedlPeYVE2lmiTpND8F0hkrealQ5hYltSmvruy/Gr5nHAKSsjyw5L3NeM/HLMI5ORv7on/M4qyZw==",
- "dependencies": {
- "Microsoft.Build.Tasks.Git": "1.1.1",
- "Microsoft.SourceLink.Common": "1.1.1"
- }
- },
- "System.Buffers": {
- "type": "Transitive",
- "resolved": "4.5.1",
- "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
- },
- "System.Numerics.Vectors": {
- "type": "Transitive",
- "resolved": "4.4.0",
- "contentHash": "UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ=="
- },
- "System.Runtime.CompilerServices.Unsafe": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Fantomas.Tests/packages.lock.json b/src/Fantomas.Tests/packages.lock.json
index 0c4cb76acb..af79929341 100644
--- a/src/Fantomas.Tests/packages.lock.json
+++ b/src/Fantomas.Tests/packages.lock.json
@@ -22,9 +22,9 @@
},
"FSharp.Core": {
"type": "Direct",
- "requested": "[6.0.1, )",
- "resolved": "6.0.1",
- "contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
+ "requested": "[8.0.100, )",
+ "resolved": "8.0.100",
+ "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"FsUnit": {
"type": "Direct",
@@ -124,8 +124,8 @@
},
"Microsoft.NETCore.Targets": {
"type": "Transitive",
- "resolved": "1.1.3",
- "contentHash": "3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ=="
+ "resolved": "1.1.0",
+ "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg=="
},
"Microsoft.TestPlatform.ObjectModel": {
"type": "Transitive",
@@ -377,15 +377,8 @@
},
"System.Buffers": {
"type": "Transitive",
- "resolved": "4.3.0",
- "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==",
- "dependencies": {
- "System.Diagnostics.Debug": "4.3.0",
- "System.Diagnostics.Tracing": "4.3.0",
- "System.Resources.ResourceManager": "4.3.0",
- "System.Runtime": "4.3.0",
- "System.Threading": "4.3.0"
- }
+ "resolved": "4.5.1",
+ "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections": {
"type": "Transitive",
@@ -416,8 +409,8 @@
},
"System.Collections.Immutable": {
"type": "Transitive",
- "resolved": "5.0.0",
- "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g=="
+ "resolved": "7.0.0",
+ "contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ=="
},
"System.Configuration.ConfigurationManager": {
"type": "Transitive",
@@ -742,8 +735,11 @@
},
"System.Reflection.Metadata": {
"type": "Transitive",
- "resolved": "1.6.0",
- "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ=="
+ "resolved": "7.0.0",
+ "contentHash": "MclTG61lsD9sYdpNz9xsKBzjsmsfCtcMZYXz/IUr2zlhaTaABonlr1ESeompTgM+Xk+IwtGYU7/voh3YWB/fWw==",
+ "dependencies": {
+ "System.Collections.Immutable": "7.0.0"
+ }
},
"System.Reflection.Primitives": {
"type": "Transitive",
@@ -778,8 +774,8 @@
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
- "resolved": "4.7.1",
- "contentHash": "zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ=="
+ "resolved": "6.0.0",
+ "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
},
"System.Runtime.Extensions": {
"type": "Transitive",
@@ -1137,7 +1133,7 @@
"type": "Project",
"dependencies": {
"Argu": "[6.1.1, )",
- "FSharp.Core": "[6.0.1, )",
+ "FSharp.Core": "[8.0.100, )",
"Fantomas.Client": "[1.0.0, )",
"Fantomas.Core": "[1.0.0, )",
"Ignore": "[0.1.50, )",
@@ -1162,17 +1158,31 @@
"fantomas.core": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "Fantomas.FCS": "[1.0.0, )"
+ "FSharp.Compiler.Service": "[43.8.200, )",
+ "FSharp.Core": "[8.0.100, )"
}
},
- "fantomas.fcs": {
+ "fsharp.compiler.service": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "System.Diagnostics.DiagnosticSource": "[7.0.0, )",
+ "FSharp.Core": "[8.0.100, )",
+ "FSharp.DependencyManager.Nuget": "[8.0.200, )",
+ "System.Buffers": "[4.5.1, )",
+ "System.Collections.Immutable": "[7.0.0, )",
+ "System.Diagnostics.DiagnosticSource": "[7.0.2, )",
"System.Memory": "[4.5.5, )",
- "System.Runtime": "[4.3.1, )"
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
+ }
+ },
+ "fsharp.dependencymanager.nuget": {
+ "type": "Project",
+ "dependencies": {
+ "FSharp.Core": "[8.0.100, )",
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
}
},
"Argu": {
@@ -1261,8 +1271,8 @@
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
- "resolved": "7.0.0",
- "contentHash": "9W0ewWDuAyDqS2PigdTxk6jDKonfgscY/hP8hm7VpxYhNHZHKvZTdRckberlFk3VnCmr3xBUyMBut12Q+T2aOw=="
+ "resolved": "7.0.2",
+ "contentHash": "hYr3I9N9811e0Bjf2WNwAGGyTuAFbbTgX1RPLt/3Wbm68x3IGcX5Cl75CMmgT6WlNwLQ2tCCWfqYPpypjaf2xA=="
},
"System.IO.Abstractions": {
"type": "CentralTransitive",
@@ -1283,11 +1293,11 @@
"System.Runtime": {
"type": "CentralTransitive",
"requested": "[4.3.1, )",
- "resolved": "4.3.1",
- "contentHash": "abhfv1dTK6NXOmu4bgHIONxHyEqFjW8HwXPmpY9gmll+ix9UNo4XDcmzJn6oLooftxNssVHdJC1pGT9jkSynQg==",
+ "resolved": "4.3.0",
+ "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==",
"dependencies": {
- "Microsoft.NETCore.Platforms": "1.1.1",
- "Microsoft.NETCore.Targets": "1.1.3"
+ "Microsoft.NETCore.Platforms": "1.1.0",
+ "Microsoft.NETCore.Targets": "1.1.0"
}
},
"Thoth.Json.Net": {
diff --git a/src/Fantomas/Daemon.fs b/src/Fantomas/Daemon.fs
index 7f2e760de8..894c1c7830 100644
--- a/src/Fantomas/Daemon.fs
+++ b/src/Fantomas/Daemon.fs
@@ -8,7 +8,7 @@ open System.Threading
open System.Threading.Tasks
open StreamJsonRpc
open Thoth.Json.Net
-open Fantomas.FCS.Text
+open FSharp.Compiler.Text
open Fantomas.Client.Contracts
open Fantomas.Client.LSPFantomasServiceTypes
open Fantomas.Core
diff --git a/src/Fantomas/packages.lock.json b/src/Fantomas/packages.lock.json
index 1c46352905..ca0f819877 100644
--- a/src/Fantomas/packages.lock.json
+++ b/src/Fantomas/packages.lock.json
@@ -41,9 +41,9 @@
},
"FSharp.Core": {
"type": "Direct",
- "requested": "[6.0.1, )",
- "resolved": "6.0.1",
- "contentHash": "VrFAiW8dEEekk+0aqlbvMNZzDvYXmgWZwAt68AUBqaWK8RnoEVUNglj66bZzhs4/U63q0EfXlhcEKnH1sTYLjw=="
+ "requested": "[8.0.100, )",
+ "resolved": "8.0.100",
+ "contentHash": "ZOVZ/o+jI3ormTZOa28Wh0tSRoyle1f7lKFcUN61sPiXI7eDZu8eSveFybgTeyIEyW0ujjp31cp7GOglDgsNEg=="
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
@@ -190,8 +190,8 @@
},
"Microsoft.NETCore.Targets": {
"type": "Transitive",
- "resolved": "1.1.3",
- "contentHash": "3Wrmi0kJDzClwAC+iBdUBpEKmEle8FQNsCs77fkiOIw/9oYA07bL1EZNX0kQ2OMN3xpwvl0vAtOCYY3ndDNlhQ=="
+ "resolved": "1.1.0",
+ "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg=="
},
"Microsoft.SourceLink.AzureRepos.Git": {
"type": "Transitive",
@@ -461,15 +461,8 @@
},
"System.Buffers": {
"type": "Transitive",
- "resolved": "4.3.0",
- "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==",
- "dependencies": {
- "System.Diagnostics.Debug": "4.3.0",
- "System.Diagnostics.Tracing": "4.3.0",
- "System.Resources.ResourceManager": "4.3.0",
- "System.Runtime": "4.3.0",
- "System.Threading": "4.3.0"
- }
+ "resolved": "4.5.1",
+ "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg=="
},
"System.Collections": {
"type": "Transitive",
@@ -500,8 +493,11 @@
},
"System.Collections.Immutable": {
"type": "Transitive",
- "resolved": "5.0.0",
- "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g=="
+ "resolved": "7.0.0",
+ "contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==",
+ "dependencies": {
+ "System.Runtime.CompilerServices.Unsafe": "6.0.0"
+ }
},
"System.Configuration.ConfigurationManager": {
"type": "Transitive",
@@ -824,6 +820,14 @@
"System.Runtime": "4.3.0"
}
},
+ "System.Reflection.Metadata": {
+ "type": "Transitive",
+ "resolved": "7.0.0",
+ "contentHash": "MclTG61lsD9sYdpNz9xsKBzjsmsfCtcMZYXz/IUr2zlhaTaABonlr1ESeompTgM+Xk+IwtGYU7/voh3YWB/fWw==",
+ "dependencies": {
+ "System.Collections.Immutable": "7.0.0"
+ }
+ },
"System.Reflection.Primitives": {
"type": "Transitive",
"resolved": "4.3.0",
@@ -1214,17 +1218,31 @@
"fantomas.core": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "Fantomas.FCS": "[1.0.0, )"
+ "FSharp.Compiler.Service": "[43.8.200, )",
+ "FSharp.Core": "[8.0.100, )"
}
},
- "fantomas.fcs": {
+ "fsharp.compiler.service": {
"type": "Project",
"dependencies": {
- "FSharp.Core": "[6.0.1, )",
- "System.Diagnostics.DiagnosticSource": "[7.0.0, )",
+ "FSharp.Core": "[8.0.100, )",
+ "FSharp.DependencyManager.Nuget": "[8.0.200, )",
+ "System.Buffers": "[4.5.1, )",
+ "System.Collections.Immutable": "[7.0.0, )",
+ "System.Diagnostics.DiagnosticSource": "[7.0.2, )",
"System.Memory": "[4.5.5, )",
- "System.Runtime": "[4.3.1, )"
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
+ }
+ },
+ "fsharp.dependencymanager.nuget": {
+ "type": "Project",
+ "dependencies": {
+ "FSharp.Core": "[8.0.100, )",
+ "System.Reflection.Emit": "[4.7.0, )",
+ "System.Reflection.Metadata": "[7.0.0, )",
+ "System.Runtime.CompilerServices.Unsafe": "[6.0.0, )"
}
},
"SemanticVersioning": {
@@ -1236,8 +1254,8 @@
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
- "resolved": "7.0.0",
- "contentHash": "9W0ewWDuAyDqS2PigdTxk6jDKonfgscY/hP8hm7VpxYhNHZHKvZTdRckberlFk3VnCmr3xBUyMBut12Q+T2aOw==",
+ "resolved": "7.0.2",
+ "contentHash": "hYr3I9N9811e0Bjf2WNwAGGyTuAFbbTgX1RPLt/3Wbm68x3IGcX5Cl75CMmgT6WlNwLQ2tCCWfqYPpypjaf2xA==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
@@ -1251,11 +1269,11 @@
"System.Runtime": {
"type": "CentralTransitive",
"requested": "[4.3.1, )",
- "resolved": "4.3.1",
- "contentHash": "abhfv1dTK6NXOmu4bgHIONxHyEqFjW8HwXPmpY9gmll+ix9UNo4XDcmzJn6oLooftxNssVHdJC1pGT9jkSynQg==",
+ "resolved": "4.3.0",
+ "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==",
"dependencies": {
- "Microsoft.NETCore.Platforms": "1.1.1",
- "Microsoft.NETCore.Targets": "1.1.3"
+ "Microsoft.NETCore.Platforms": "1.1.0",
+ "Microsoft.NETCore.Targets": "1.1.0"
}
}
}