diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 9e7e67e5a..6460206bb 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -2,24 +2,6 @@ "version": 1, "isRoot": true, "tools": { - "fake-cli": { - "version": "5.23.0", - "commands": [ - "fake" - ] - }, - "paket": { - "version": "7.2.0-alpha001", - "commands": [ - "paket" - ] - }, - "octonav": { - "version": "0.0.1", - "commands": [ - "octonav" - ] - }, "dotnet-reportgenerator-globaltool": { "version": "5.0.2", "commands": [ @@ -27,10 +9,10 @@ ] }, "fantomas": { - "version": "5.0.0", + "version": "5.2.0", "commands": [ "fantomas" ] } } -} \ No newline at end of file +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 805fafde4..cec999b40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: Build and test -on: +on: push: branches: - main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d45865e13..8e7edfe1d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,9 @@ on: jobs: release: + env: + IsRelease: true + runs-on: ubuntu-latest steps: diff --git a/.paket/Paket.Restore.targets b/.paket/Paket.Restore.targets deleted file mode 100644 index e230bb215..000000000 --- a/.paket/Paket.Restore.targets +++ /dev/null @@ -1,557 +0,0 @@ - - - - - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - $(MSBuildVersion) - 15.0.0 - false - true - - true - $(MSBuildThisFileDirectory) - $(MSBuildThisFileDirectory)..\ - $(PaketRootPath)paket-files\paket.restore.cached - $(PaketRootPath)paket.lock - classic - proj - assembly - native - /Library/Frameworks/Mono.framework/Commands/mono - mono - - - $(PaketRootPath)paket.bootstrapper.exe - $(PaketToolsPath)paket.bootstrapper.exe - $([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\ - - "$(PaketBootStrapperExePath)" - $(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)" - - - - - true - true - - - True - - - False - - $(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/')) - - - - - - - - - $(PaketRootPath)paket - $(PaketToolsPath)paket - - - - - - $(PaketRootPath)paket.exe - $(PaketToolsPath)paket.exe - - - - - - <_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json")) - <_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"')) - <_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false - - - - - - - - - - - <_PaketCommand>dotnet paket - - - - - - $(PaketToolsPath)paket - $(PaketBootStrapperExeDir)paket - - - paket - - - - - <_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)")) - <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)" - <_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)" - <_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)" - - - - - - - - - - - - - - - - - - - - - true - $(NoWarn);NU1603;NU1604;NU1605;NU1608 - false - true - - - - - - - - - $([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)')) - - - - - - - $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[0].Replace(`"`, ``).Replace(` `, ``)) - $([System.Text.RegularExpressions.Regex]::Split(`%(Identity)`, `": "`)[1].Replace(`"`, ``).Replace(` `, ``)) - - - - - %(PaketRestoreCachedKeyValue.Value) - %(PaketRestoreCachedKeyValue.Value) - - - - - true - false - true - - - - - true - - - - - - - - - - - - - - - - - - - $(PaketIntermediateOutputPath)\$(MSBuildProjectFile).paket.references.cached - - $(MSBuildProjectFullPath).paket.references - - $(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references - - $(MSBuildProjectDirectory)\paket.references - - false - true - true - references-file-or-cache-not-found - - - - - $([System.IO.File]::ReadAllText('$(PaketReferencesCachedFilePath)')) - $([System.IO.File]::ReadAllText('$(PaketOriginalReferencesFilePath)')) - references-file - false - - - - - false - - - - - true - target-framework '$(TargetFramework)' or '$(TargetFrameworks)' files @(PaketResolvedFilePaths) - - - - - - - - - - - false - true - - - - - - - - - - - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',').Length) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[5]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[6]) - $([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[7]) - - - %(PaketReferencesFileLinesInfo.PackageVersion) - All - runtime - $(ExcludeAssets);contentFiles - $(ExcludeAssets);build;buildMultitargeting;buildTransitive - true - true - - - - - $(PaketIntermediateOutputPath)/$(MSBuildProjectFile).paket.clitools - - - - - - - - - $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[0]) - $([System.String]::Copy('%(PaketCliToolFileLines.Identity)').Split(',')[1]) - - - %(PaketCliToolFileLinesInfo.PackageVersion) - - - - - - - - - - false - - - - - - <_NuspecFilesNewLocation Include="$(PaketIntermediateOutputPath)\$(Configuration)\*.nuspec"/> - - - - - - $(MSBuildProjectDirectory)/$(MSBuildProjectFile) - true - false - true - false - true - false - true - false - true - false - true - $(PaketIntermediateOutputPath)\$(Configuration) - $(PaketIntermediateOutputPath) - - - - <_NuspecFiles Include="$(AdjustedNuspecOutputPath)\*.$(PackageVersion.Split(`+`)[0]).nuspec"/> - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.paket/paket.targets b/.paket/paket.targets deleted file mode 100644 index 22c9f0a87..000000000 --- a/.paket/paket.targets +++ /dev/null @@ -1,38 +0,0 @@ - - - - - true - - true - $(MSBuildThisFileDirectory) - $(MSBuildThisFileDirectory)..\ - - - - $(PaketToolsPath)paket.exe - $(PaketToolsPath)paket.bootstrapper.exe - "$(PaketExePath)" - mono --runtime=v4.0.30319 $(PaketExePath) - "$(PaketBootStrapperExePath)" - mono --runtime=v4.0.30319 $(PaketBootStrapperExePath) - - $(MSBuildProjectDirectory)\paket.references - $(MSBuildProjectFullPath).paket.references - $(PaketCommand) restore --references-files "$(PaketReferences)" - $(PaketBootStrapperCommand) - - RestorePackages; $(BuildDependsOn); - - - - - - - - - - - - - diff --git a/Directory.Build.props b/Directory.Build.props index 38d655380..16d6938b2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,9 +4,16 @@ FsAutoComplete FsAutoComplete Apache-2.0 - 3186 + $(NoWarn);3186 + $(NoWarn);NU1608 + $(NoWarn);NU1605 true $(MSBuildThisFileDirectory)CHANGELOG.md + + + + + diff --git a/FsAutoComplete.sln b/FsAutoComplete.sln index 7bc5d8f13..36c258cdc 100644 --- a/FsAutoComplete.sln +++ b/FsAutoComplete.sln @@ -3,12 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28803.452 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{1BE8AF57-B314-4C92-82A9-64CD9B7A4990}" - ProjectSection(SolutionItems) = preProject - paket.dependencies = paket.dependencies - paket.lock = paket.lock - EndProjectSection -EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsAutoComplete", "src\FsAutoComplete\FsAutoComplete.fsproj", "{B6AB4EF3-8F60-41A1-AB0C-851A6DEB169E}" EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FsAutoComplete.Core", "src\FsAutoComplete.Core\FsAutoComplete.Core.fsproj", "{4E4786F3-4566-44E1-8787-91790007F0F6}" diff --git a/build/Program.fs b/build/Program.fs index b2104f594..b4b2c12a1 100644 --- a/build/Program.fs +++ b/build/Program.fs @@ -6,8 +6,6 @@ open Fake.DotNet open Fake.Core.TargetOperators open Fake.Tools -System.Environment.CurrentDirectory <- (Path.combine __SOURCE_DIRECTORY__ "..") - let project = "FsAutoComplete" let changeLogFile = "CHANGELOG.md" let mutable changelogs = Changelog.load changeLogFile @@ -101,16 +99,6 @@ let init args = (fun p -> { p with Configuration = DotNet.BuildConfiguration.fromString configuration }) "FsAutoComplete.sln") - Target.create "ReplaceFsLibLogNamespaces" - <| fun _ -> - let replacements = - [ "FsLibLog\\n", "FsAutoComplete.Logging\n" - "FsLibLog\\.", "FsAutoComplete.Logging" ] - - replacements - |> List.iter (fun (``match``, replace) -> - (!! "paket-files/TheAngryByrd/FsLibLog/**/FsLibLog*.fs") - |> Shell.regexReplaceInFilesWithEncoding ``match`` replace System.Text.Encoding.UTF8) Target.create "Format" (fun _ -> let result = @@ -210,13 +198,12 @@ let init args = "PromoteUnreleasedToVersion" ==> "CreateVersionTag" ==> "Promote" |> ignore - "Restore" ==> "ReplaceFsLibLogNamespaces" ==> "Build" |> ignore + "Restore" ==> "Build" |> ignore "CheckFormat" ==> "Build" ==> "LspTest" ==> "Coverage" ==> "Test" ==> "All" |> ignore - "ReplaceFsLibLogNamespaces" - ==> "LocalRelease" + "LocalRelease" ==> "ReleaseArchive" ==> "Release" |> ignore diff --git a/build/build.fsproj b/build/build.fsproj index 8d7387f0c..a53f796f7 100644 --- a/build/build.fsproj +++ b/build/build.fsproj @@ -7,5 +7,14 @@ - - \ No newline at end of file + + + + + + + + + + + diff --git a/build/paket.references b/build/paket.references deleted file mode 100644 index 84895ac7b..000000000 --- a/build/paket.references +++ /dev/null @@ -1,17 +0,0 @@ -group Build - Fake.Core.Target - Fake.Core.Process - Fake.DotNet.Cli - Fake.Core.ReleaseNotes - Fake.DotNet.AssemblyInfoFile - Fake.DotNet.Paket - Fake.Tools.Git - Fake.Core.Environment - Fake.Core.UserInput - Fake.IO.FileSystem - Fake.IO.Zip - Fake.DotNet.MsBuild - Fake.Api.GitHub - Microsoft.Build - MSBuild.StructuredLogger - Octokit diff --git a/paket.dependencies b/paket.dependencies deleted file mode 100644 index 8a1ceaeb6..000000000 --- a/paket.dependencies +++ /dev/null @@ -1,73 +0,0 @@ -version 7.2.0-alpha001 - -framework: netstandard2.0, net6.0, net7.0 - -source https://api.nuget.org/v3/index.json -# this is the FCS nightly feed, re-enable at your own risk! -#source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json -#source: ./libs -storage: none - -github TheAngryByrd/FsLibLog:f81cba440bf0476bb4e2262b57a067a0d6ab78a7 src/FsLibLog/FsLibLog.fs - -nuget Fantomas.Client -nuget FSharp.Compiler.Service -nuget Ionide.ProjInfo -nuget Ionide.ProjInfo.FCS -nuget Ionide.ProjInfo.ProjectSystem -nuget Ionide.ProjInfo.Sln -nuget Microsoft.Build copy_local:false -nuget Microsoft.Build.Framework copy_local:false -nuget Microsoft.Build.Utilities.Core copy_local:false -nuget Microsoft.Build.Tasks.Core copy_local: false -nuget FSharp.Analyzers.SDK -nuget ICSharpCode.Decompiler -nuget Mono.Cecil -nuget Newtonsoft.Json -nuget FSharpLint.Core -nuget FSharp.Core content: none -nuget System.Configuration.ConfigurationManager -nuget Serilog -nuget Serilog.Sinks.File -nuget Serilog.Sinks.Console -nuget Serilog.Sinks.Async -nuget Destructurama.FSharp -nuget FSharp.UMX -nuget FSharp.Formatting -nuget FsToolkit.ErrorHandling -nuget FSharpx.Async -nuget CliWrap -nuget System.CommandLine prerelease -nuget FSharp.Data.Adaptive -nuget Microsoft.NET.Test.Sdk -nuget Dotnet.ReproducibleBuilds copy_local:true - -nuget Microsoft.NETFramework.ReferenceAssemblies -nuget Ionide.KeepAChangelog.Tasks copy_local: true -nuget Expecto -nuget Expecto.Diff -nuget YoloDev.Expecto.TestSdk -nuget AltCover -nuget GitHubActionsTestLogger -nuget Ionide.LanguageServerProtocol - -group Build - source https://api.nuget.org/v3/index.json - storage: none - - nuget Fake.Core.Target - nuget Fake.Core.Process - nuget Fake.DotNet.Cli - nuget Fake.Core.ReleaseNotes - nuget Fake.DotNet.AssemblyInfoFile - nuget Fake.DotNet.Paket - nuget Fake.Tools.Git - nuget Fake.Core.Environment - nuget Fake.Core.UserInput - nuget Fake.IO.FileSystem - nuget Fake.IO.Zip - nuget Fake.DotNet.MsBuild - nuget Fake.Api.GitHub - nuget Microsoft.Build - nuget MSBuild.StructuredLogger - nuget Octokit 0.48 // there's an API break in 0.50, so we need to pin this to prevent errors diff --git a/paket.lock b/paket.lock deleted file mode 100644 index 89e2382c6..000000000 --- a/paket.lock +++ /dev/null @@ -1,1026 +0,0 @@ -STORAGE: NONE -RESTRICTION: || (== net6.0) (== net7.0) (== netstandard2.0) -NUGET - remote: https://api.nuget.org/v3/index.json - altcover (8.3.838) - CliWrap (3.4.4) - Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) - Destructurama.FSharp (1.2) - FSharp.Core (>= 4.3.4) - Serilog (>= 2.0 < 3.0) - DiffPlex (1.7.1) - DotNet.ReproducibleBuilds (1.1.1) - copy_local: true - 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) - Expecto (9.0.4) - FSharp.Core (>= 4.6) - Mono.Cecil (>= 0.11.3) - Expecto.Diff (9.0.4) - DiffPlex (>= 1.6.3) - Expecto (>= 9.0.4) - FSharp.Core (>= 4.6) - Fantomas.Client (0.7) - FSharp.Core (>= 5.0.1) - SemanticVersioning (>= 2.0.2) - StreamJsonRpc (>= 2.8.28) - FParsec (1.1.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - FSharp.Core (>= 4.3.4) - FSharp.Analyzers.SDK (0.11) - FSharp.Compiler.Service (>= 41.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - FSharp.Core (>= 6.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - McMaster.NETCore.Plugins (>= 1.4) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - FSharp.Compiler.Service (41.0.5) - FSharp.Core (6.0.5) - Microsoft.Build.Framework (>= 17.0) - Microsoft.Build.Tasks.Core (>= 17.0) - Microsoft.Build.Utilities.Core (>= 17.0) - System.Buffers (>= 4.5.1) - System.Collections.Immutable (>= 5.0) - System.Diagnostics.Process (>= 4.3) - System.Diagnostics.TraceSource (>= 4.3) - System.Linq.Expressions (>= 4.3) - System.Linq.Queryable (>= 4.3) - System.Memory (>= 4.5.4) - System.Net.Requests (>= 4.3) - System.Net.Security (>= 4.3.1) - System.Reflection.Emit (>= 4.3) - System.Reflection.Metadata (>= 5.0) - System.Reflection.TypeExtensions (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Runtime.InteropServices (>= 4.3) - System.Runtime.Loader (>= 4.3) - System.Security.Claims (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Principal (>= 4.3) - System.Threading.Tasks.Parallel (>= 4.3) - System.Threading.Thread (>= 4.3) - System.Threading.ThreadPool (>= 4.3) - FSharp.Control.AsyncSeq (3.2.1) - FSharp.Core (>= 4.7.2) - Microsoft.Bcl.AsyncInterfaces (>= 5.0) - FSharp.Control.Reactive (5.0.5) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - FSharp.Core (>= 4.7.2) - System.Reactive (>= 5.0 < 6.0) - FSharp.Core (6.0.5) - content: none - FSharp.Data.Adaptive (1.2.13) - FSharp.Core (>= 4.7) - System.Reflection.Emit.Lightweight (>= 4.6) - FSharp.Formatting (14.0.1) - FSharp.Compiler.Service (>= 40.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netstandard2.1)) - FSharp.UMX (1.1) - FSharp.Core (>= 4.3.4) - FSharpLint.Core (0.21.2) - FParsec (>= 1.1.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - FSharp.Compiler.Service (>= 40.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - FSharp.Core (>= 5.0.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Ionide.ProjInfo (>= 0.53.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Ionide.ProjInfo.FCS (>= 0.53.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Ionide.ProjInfo.ProjectSystem (>= 0.53.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Microsoft.Build (>= 16.10) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Microsoft.Build.Framework (>= 16.10) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Microsoft.Build.Locator (>= 1.4.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Microsoft.Build.Tasks.Core (>= 16.10) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Microsoft.Build.Utilities.Core (>= 16.10) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - FSharpx.Async (1.14.1) - FSharp.Control.AsyncSeq (>= 2.0.21) - FSharp.Core (>= 4.6.2) - FsToolkit.ErrorHandling (2.13) - FSharp.Core (>= 4.7.2) - GitHubActionsTestLogger (2.0.1) - Microsoft.TestPlatform.ObjectModel (>= 17.2) - ICSharpCode.Decompiler (7.2.1.6856) - Microsoft.Win32.Registry (>= 5.0) - System.Collections.Immutable (>= 5.0) - System.Reflection.Metadata (>= 5.0) - Ionide.KeepAChangelog.Tasks (0.1.8) - copy_local: true - Ionide.LanguageServerProtocol (0.4.10) - FSharp.Core (>= 6.0) - Newtonsoft.Json (>= 13.0.1) - StreamJsonRpc (>= 2.10.44) - Ionide.ProjInfo (0.61) - FSharp.Core (>= 6.0.5) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Ionide.ProjInfo.Sln (>= 0.61) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Microsoft.Build (>= 17.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Microsoft.Build.Framework (>= 17.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - SemanticVersioning (>= 2.0.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Ionide.ProjInfo.FCS (0.61) - FSharp.Compiler.Service (>= 41.0.5 < 42.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - FSharp.Core (>= 6.0.5) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Ionide.ProjInfo (>= 0.61) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Ionide.ProjInfo.ProjectSystem (0.61) - FSharp.Compiler.Service (>= 41.0.5 < 42.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - FSharp.Control.Reactive (>= 5.0.5) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - FSharp.Core (>= 6.0.5) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Ionide.ProjInfo (>= 0.61) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Ionide.ProjInfo.FCS (>= 0.61) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Ionide.ProjInfo.Sln (>= 0.61) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Newtonsoft.Json (>= 13.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - Ionide.ProjInfo.Sln (0.61) - McMaster.NETCore.Plugins (1.4) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Microsoft.DotNet.PlatformAbstractions (>= 3.1.6) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp2.1)) - Microsoft.Extensions.DependencyModel (>= 5.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp2.1)) - MessagePack (2.4.35) - MessagePack.Annotations (>= 2.4.35) - Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - Microsoft.NET.StringTools (>= 1.0) - System.Collections.Immutable (>= 1.7.1) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Reflection.Emit (>= 4.7) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Reflection.Emit.Lightweight (>= 4.7) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - MessagePack.Annotations (2.4.35) - Microsoft.Bcl.AsyncInterfaces (6.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) - Microsoft.Build (17.2) - copy_local: false - Microsoft.Build.Framework (>= 17.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) - Microsoft.NET.StringTools (>= 1.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) - Microsoft.Win32.Registry (>= 4.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - System.Collections.Immutable (>= 5.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) - System.Configuration.ConfigurationManager (>= 4.7) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) - System.Reflection.Metadata (>= 1.6) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - System.Security.Principal.Windows (>= 4.7) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - System.Text.Encoding.CodePages (>= 4.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - System.Text.Json (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) - System.Threading.Tasks.Dataflow (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) - Microsoft.Build.Framework (17.2) - copy_local: false - Microsoft.Win32.Registry (>= 4.3) - System.Security.Permissions (>= 4.7) - Microsoft.Build.Locator (1.5.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Microsoft.Build.Tasks.Core (17.2) - copy_local: false - Microsoft.Build.Framework (>= 17.2) - Microsoft.Build.Utilities.Core (>= 17.2) - Microsoft.NET.StringTools (>= 1.0) - Microsoft.Win32.Registry (>= 4.3) - System.CodeDom (>= 4.4) - System.Collections.Immutable (>= 5.0) - System.Reflection.Metadata (>= 1.6) - System.Resources.Extensions (>= 4.6) - System.Security.Cryptography.Pkcs (>= 4.7) - System.Security.Cryptography.Xml (>= 4.7) - System.Security.Permissions (>= 4.7) - System.Threading.Tasks.Dataflow (>= 6.0) - Microsoft.Build.Tasks.Git (1.1.1) - copy_local: true - Microsoft.Build.Utilities.Core (17.2) - copy_local: false - Microsoft.Build.Framework (>= 17.2) - Microsoft.NET.StringTools (>= 1.0) - Microsoft.Win32.Registry (>= 4.3) - System.Collections.Immutable (>= 5.0) - System.Configuration.ConfigurationManager (>= 4.7) - System.Security.Permissions (>= 4.7) - restriction: || (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Text.Encoding.CodePages (>= 4.0.1) - restriction: || (&& (== net7.0) (< net6.0)) (== netstandard2.0) - Microsoft.CodeCoverage (17.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.DotNet.PlatformAbstractions (3.1.6) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - Microsoft.Extensions.DependencyModel (6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net5.0)) - System.Buffers (>= 4.5.1) - System.Memory (>= 4.5.4) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Encodings.Web (>= 6.0) - System.Text.Json (>= 6.0) - Microsoft.NET.StringTools (17.3.1) - copy_local: false - System.Memory (>= 4.5.5) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - Microsoft.NET.Test.Sdk (17.3) - Microsoft.CodeCoverage (>= 17.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net45)) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.TestPlatform.TestHost (>= 17.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.NETCore.Platforms (6.0.5) - Microsoft.NETCore.Targets (5.0) - Microsoft.NETFramework.ReferenceAssemblies (1.0.3) - Microsoft.SourceLink.AzureRepos.Git (1.1.1) - copy_local: true - Microsoft.Build.Tasks.Git (>= 1.1.1) - Microsoft.SourceLink.Common (>= 1.1.1) - Microsoft.SourceLink.Bitbucket.Git (1.1.1) - copy_local: true - Microsoft.Build.Tasks.Git (>= 1.1.1) - Microsoft.SourceLink.Common (>= 1.1.1) - Microsoft.SourceLink.Common (1.1.1) - copy_local: true - Microsoft.SourceLink.GitHub (1.1.1) - copy_local: true - Microsoft.Build.Tasks.Git (>= 1.1.1) - Microsoft.SourceLink.Common (>= 1.1.1) - Microsoft.SourceLink.GitLab (1.1.1) - copy_local: true - Microsoft.Build.Tasks.Git (>= 1.1.1) - Microsoft.SourceLink.Common (>= 1.1.1) - Microsoft.TestPlatform.ObjectModel (17.3) - NuGet.Frameworks (>= 5.11) - System.Reflection.Metadata (>= 1.6) - Microsoft.TestPlatform.TestHost (17.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) - Microsoft.TestPlatform.ObjectModel (>= 17.3) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0)) - Newtonsoft.Json (>= 9.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp1.0)) (&& (== netstandard2.0) (>= uap10.0)) - Microsoft.VisualStudio.Threading (17.3.44) - Microsoft.Bcl.AsyncInterfaces (>= 6.0) - Microsoft.VisualStudio.Threading.Analyzers (>= 17.3.44) - Microsoft.VisualStudio.Validation (>= 17.0.58) - Microsoft.Win32.Registry (>= 5.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - Microsoft.VisualStudio.Threading.Analyzers (17.3.44) - Microsoft.VisualStudio.Validation (17.0.64) - Microsoft.Win32.Primitives (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - Microsoft.Win32.Registry (5.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monoandroid) (< netstandard1.3)) (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (&& (== net7.0) (>= monoandroid) (< netstandard1.3)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (>= uap10.1)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (>= uap10.1)) (== netstandard2.0) - System.Security.AccessControl (>= 5.0) - System.Security.Principal.Windows (>= 5.0) - Microsoft.Win32.SystemEvents (6.0.1) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) - Mono.Cecil (0.11.4) - Nerdbank.Streams (2.8.61) - Microsoft.Bcl.AsyncInterfaces (>= 5.0) - Microsoft.VisualStudio.Threading (>= 16.10.56) - Microsoft.VisualStudio.Validation (>= 16.10.26) - System.IO.Pipelines (>= 5.0.1) - System.Runtime.CompilerServices.Unsafe (>= 5.0) - Newtonsoft.Json (13.0.1) - NuGet.Frameworks (6.3) - runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.native.System (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - runtime.native.System.Net.Http (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - runtime.native.System.Net.Security (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - runtime.native.System.Security.Cryptography.Apple (4.3.1) - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) - runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.debian.9-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.fedora.27-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.fedora.28-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.3) - runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.opensuse.42.3-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3.1) - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - runtime.ubuntu.18.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.3) - SemanticVersioning (2.0.2) - Serilog (2.11) - Serilog.Sinks.Async (1.5) - Serilog (>= 2.9) - Serilog.Sinks.Console (4.0.1) - Serilog (>= 2.10) - Serilog.Sinks.File (5.0) - Serilog (>= 2.10) - StreamJsonRpc (2.12.27) - MessagePack (>= 2.3.85) - Microsoft.Bcl.AsyncInterfaces (>= 6.0) - Microsoft.VisualStudio.Threading (>= 17.1.46) - Nerdbank.Streams (>= 2.8.57) - Newtonsoft.Json (>= 13.0.1) - System.Collections.Immutable (>= 6.0) - System.Diagnostics.DiagnosticSource (>= 6.0) - System.IO.Pipelines (>= 6.0.3) - System.Threading.Tasks.Dataflow (>= 6.0) - System.Buffers (4.5.1) - System.CodeDom (6.0) - copy_local: false - System.Collections (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Collections.Concurrent (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Globalization (>= 4.3) - System.Reflection (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Collections.Immutable (6.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.CommandLine (2.0.0-beta4.22272.1) - System.Memory (>= 4.5.4) - restriction: || (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Configuration.ConfigurationManager (6.0) - System.Security.Cryptography.ProtectedData (>= 6.0) - System.Security.Permissions (>= 6.0) - System.Diagnostics.Debug (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Diagnostics.DiagnosticSource (6.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< net5.0)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< net5.0)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Diagnostics.Process (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.Win32.Primitives (>= 4.3) - Microsoft.Win32.Registry (>= 4.3) - runtime.native.System (>= 4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.IO.FileSystem (>= 4.3) - System.IO.FileSystem.Primitives (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Text.Encoding.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Threading.Thread (>= 4.3) - System.Threading.ThreadPool (>= 4.3) - System.Diagnostics.TraceSource (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - runtime.native.System (>= 4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Diagnostics.Tracing (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Drawing.Common (6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) - Microsoft.Win32.SystemEvents (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) - System.Formats.Asn1 (6.0) - copy_local: false - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Globalization (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Globalization.Calendars (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Globalization (>= 4.3) - System.Runtime (>= 4.3) - System.Globalization.Extensions (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - System.Globalization (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.IO (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.IO.FileSystem (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.IO (>= 4.3) - System.IO.FileSystem.Primitives (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.IO.FileSystem.Primitives (4.3) - System.Runtime (>= 4.3) - System.IO.Pipelines (6.0.3) - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp3.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp3.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp3.1)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp3.1)) (== netstandard2.0) - System.Linq (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Linq.Expressions (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.Linq (>= 4.3) - System.ObjectModel (>= 4.3) - System.Reflection (>= 4.3) - System.Reflection.Emit (>= 4.3) - System.Reflection.Emit.ILGeneration (>= 4.3) - System.Reflection.Emit.Lightweight (>= 4.3) - System.Reflection.Extensions (>= 4.3) - System.Reflection.Primitives (>= 4.3) - System.Reflection.TypeExtensions (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Linq.Queryable (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Linq (>= 4.3) - System.Linq.Expressions (>= 4.3) - System.Reflection (>= 4.3) - System.Reflection.Extensions (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Memory (4.5.5) - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0) - System.Numerics.Vectors (>= 4.4) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.0)) (== netstandard2.0) - System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= monotouch)) (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.0)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= uap10.1)) (&& (== net6.0) (>= xamarinios)) (&& (== net6.0) (>= xamarinmac)) (&& (== net6.0) (>= xamarintvos)) (&& (== net6.0) (>= xamarinwatchos)) (&& (== net7.0) (>= monotouch)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= uap10.1)) (&& (== net7.0) (>= xamarinios)) (&& (== net7.0) (>= xamarinmac)) (&& (== net7.0) (>= xamarintvos)) (&& (== net7.0) (>= xamarinwatchos)) (== netstandard2.0) - System.Net.Http (4.3.4) - Microsoft.NETCore.Platforms (>= 1.1.1) - runtime.native.System (>= 4.3) - runtime.native.System.Net.Http (>= 4.3) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Diagnostics.DiagnosticSource (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Globalization (>= 4.3) - System.Globalization.Extensions (>= 4.3) - System.IO (>= 4.3) - System.IO.FileSystem (>= 4.3) - System.Net.Primitives (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.OpenSsl (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Security.Cryptography.X509Certificates (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Net.Primitives (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime (>= 4.3.1) - System.Runtime.Handles (>= 4.3) - System.Net.Requests (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.Net.Http (>= 4.3) - System.Net.Primitives (>= 4.3) - System.Net.WebHeaderCollection (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Net.Security (4.3.2) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.Win32.Primitives (>= 4.3) - runtime.native.System (>= 4.3) - runtime.native.System.Net.Security (>= 4.3) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - System.Collections (>= 4.3) - System.Collections.Concurrent (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Globalization (>= 4.3) - System.Globalization.Extensions (>= 4.3) - System.IO (>= 4.3) - System.Net.Primitives (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Security.Claims (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.OpenSsl (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Security.Cryptography.X509Certificates (>= 4.3) - System.Security.Principal (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Threading.ThreadPool (>= 4.3) - System.Net.WebHeaderCollection (4.3) - System.Collections (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Numerics.Vectors (4.5) - restriction: || (&& (== net6.0) (< netcoreapp2.0)) (&& (== net7.0) (< netcoreapp2.0)) (== netstandard2.0) - System.ObjectModel (4.3) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Threading (>= 4.3) - System.Reactive (5.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net6.0)) - System.Reflection (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.IO (>= 4.3) - System.Reflection.Primitives (>= 4.3) - System.Runtime (>= 4.3) - System.Reflection.Emit (4.7) - System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== net6.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net6.0) (< netstandard1.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= uap10.1)) (&& (== net7.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net7.0) (< netstandard1.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= uap10.1)) (== netstandard2.0) - System.Reflection.Emit.ILGeneration (4.7) - System.Reflection.Emit.Lightweight (4.7) - System.Reflection.Emit.ILGeneration (>= 4.7) - restriction: || (&& (== net6.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (< portable-net45+wp8)) (&& (== net6.0) (>= uap10.1)) (&& (== net7.0) (< netcoreapp2.0) (< netstandard2.1)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (< portable-net45+wp8)) (&& (== net7.0) (>= uap10.1)) (== netstandard2.0) - System.Reflection.Extensions (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Reflection (>= 4.3) - System.Runtime (>= 4.3) - System.Reflection.Metadata (6.0.1) - System.Collections.Immutable (>= 6.0) - System.Reflection.Primitives (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Reflection.TypeExtensions (4.7) - System.Resources.Extensions (6.0) - copy_local: false - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Resources.ResourceManager (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Globalization (>= 4.3) - System.Reflection (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime.CompilerServices.Unsafe (6.0) - System.Runtime.Extensions (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1.1) - Microsoft.NETCore.Targets (>= 1.1.3) - System.Runtime (>= 4.3.1) - System.Runtime.Handles (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Runtime.InteropServices (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Reflection (>= 4.3) - System.Reflection.Primitives (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.Loader (4.3) - System.IO (>= 4.3) - System.Reflection (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Numerics (4.3) - System.Globalization (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Security.AccessControl (6.0) - System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Security.Claims (4.3) - System.Collections (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Security.Principal (>= 4.3) - System.Security.Cryptography.Algorithms (4.3.1) - Microsoft.NETCore.Platforms (>= 1.1) - runtime.native.System.Security.Cryptography.Apple (>= 4.3.1) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - System.Collections (>= 4.3) - System.IO (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Runtime.Numerics (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Security.Cryptography.Cng (5.0) - copy_local: false - System.Security.Cryptography.Csp (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - System.IO (>= 4.3) - System.Reflection (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading (>= 4.3) - System.Security.Cryptography.Encoding (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - System.Collections (>= 4.3) - System.Collections.Concurrent (>= 4.3) - System.Linq (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Security.Cryptography.OpenSsl (5.0) - System.Formats.Asn1 (>= 5.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.0)) - System.Security.Cryptography.Pkcs (6.0.1) - copy_local: false - System.Buffers (>= 4.5.1) - restriction: || (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) - System.Formats.Asn1 (>= 6.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) - System.Security.Cryptography.Cng (>= 5.0) - restriction: || (&& (== net6.0) (< netcoreapp3.1)) (&& (== net6.0) (< netstandard2.1)) (&& (== net7.0) (< net6.0)) (&& (== net7.0) (< netcoreapp3.1)) (&& (== net7.0) (< netstandard2.1)) (== netstandard2.0) - System.Security.Cryptography.Primitives (4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.IO (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Security.Cryptography.ProtectedData (6.0) - System.Memory (>= 4.5.4) - restriction: || (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Security.Cryptography.X509Certificates (4.3.2) - Microsoft.NETCore.Platforms (>= 1.1) - runtime.native.System (>= 4.3) - runtime.native.System.Net.Http (>= 4.3) - runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.2) - System.Collections (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Globalization (>= 4.3) - System.Globalization.Calendars (>= 4.3) - System.IO (>= 4.3) - System.IO.FileSystem (>= 4.3) - System.IO.FileSystem.Primitives (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Runtime.InteropServices (>= 4.3) - System.Runtime.Numerics (>= 4.3) - System.Security.Cryptography.Algorithms (>= 4.3) - System.Security.Cryptography.Cng (>= 4.3) - System.Security.Cryptography.Csp (>= 4.3) - System.Security.Cryptography.Encoding (>= 4.3) - System.Security.Cryptography.OpenSsl (>= 4.3) - System.Security.Cryptography.Primitives (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Threading (>= 4.3) - System.Security.Cryptography.Xml (6.0.1) - copy_local: false - System.Memory (>= 4.5.4) - restriction: || (&& (== net7.0) (< net6.0)) (== netstandard2.0) - System.Security.AccessControl (>= 6.0) - System.Security.Cryptography.Pkcs (>= 6.0.1) - System.Security.Permissions (6.0) - System.Security.AccessControl (>= 6.0) - System.Windows.Extensions (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) - System.Security.Principal (4.3) - System.Runtime (>= 4.3) - System.Security.Principal.Windows (5.0) - copy_local: false - System.Text.Encoding (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Text.Encoding.CodePages (6.0) - copy_local: false - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Encoding.Extensions (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Text.Encoding (>= 4.3) - System.Text.Encodings.Web (6.0) - copy_local: false, restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Json (6.0.5) - copy_local: false, restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= net472)) (&& (== netstandard2.0) (>= net6.0)) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - System.Text.Encodings.Web (>= 6.0) - System.Threading (4.3) - System.Runtime (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Threading.Tasks (4.3) - Microsoft.NETCore.Platforms (>= 1.1) - Microsoft.NETCore.Targets (>= 1.1) - System.Runtime (>= 4.3) - System.Threading.Tasks.Dataflow (6.0) - copy_local: false - System.Threading.Tasks.Extensions (4.5.4) - System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (== net6.0) (>= net461)) (&& (== net6.0) (< netcoreapp2.1)) (&& (== net6.0) (< netstandard1.0)) (&& (== net6.0) (< netstandard2.0)) (&& (== net6.0) (>= wp8)) (&& (== net7.0) (>= net461)) (&& (== net7.0) (< netcoreapp2.1)) (&& (== net7.0) (< netstandard1.0)) (&& (== net7.0) (< netstandard2.0)) (&& (== net7.0) (>= wp8)) (== netstandard2.0) - System.Threading.Tasks.Parallel (4.3) - System.Collections.Concurrent (>= 4.3) - System.Diagnostics.Debug (>= 4.3) - System.Diagnostics.Tracing (>= 4.3) - System.Resources.ResourceManager (>= 4.3) - System.Runtime (>= 4.3) - System.Runtime.Extensions (>= 4.3) - System.Threading (>= 4.3) - System.Threading.Tasks (>= 4.3) - System.Threading.Thread (4.3) - System.Runtime (>= 4.3) - System.Threading.ThreadPool (4.3) - System.Runtime (>= 4.3) - System.Runtime.Handles (>= 4.3) - System.Windows.Extensions (6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) - System.Drawing.Common (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) - YoloDev.Expecto.TestSdk (0.13.3) - Expecto (>= 9.0 < 10.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) - FSharp.Core (>= 4.6.2) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) - System.Collections.Immutable (>= 6.0) - restriction: || (== net6.0) (== net7.0) (&& (== netstandard2.0) (>= netcoreapp3.1)) -GITHUB - remote: TheAngryByrd/FsLibLog - src/FsLibLog/FsLibLog.fs (f81cba440bf0476bb4e2262b57a067a0d6ab78a7) -GROUP Build -STORAGE: NONE -NUGET - remote: https://api.nuget.org/v3/index.json - BlackFox.VsWhere (1.1) - restriction: >= netstandard2.0 - FSharp.Core (>= 4.0.0.1) - restriction: >= net45 - FSharp.Core (>= 4.2.3) - restriction: && (< net45) (>= netstandard2.0) - Microsoft.Win32.Registry (>= 4.7) - restriction: && (< net45) (>= netstandard2.0) - Fake.Api.GitHub (5.20.4) - FSharp.Core (>= 4.7.2) - restriction: >= netstandard2.0 - Octokit (>= 0.48) - restriction: >= netstandard2.0 - Fake.Core.CommandLineParsing (5.23) - restriction: >= netstandard2.0 - FParsec (>= 1.1.1) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.Context (5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.Environment (5.23) - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.FakeVar (5.23) - restriction: >= netstandard2.0 - Fake.Core.Context (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.Process (5.23) - Fake.Core.Environment (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.FakeVar (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - System.Collections.Immutable (>= 5.0) - restriction: >= netstandard2.0 - Fake.Core.ReleaseNotes (5.23) - Fake.Core.SemVer (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.SemVer (5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.String (5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.Target (5.23) - Fake.Core.CommandLineParsing (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Context (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Environment (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.FakeVar (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Process (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Control.Reactive (>= 5.0.2) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.Tasks (5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.Trace (5.23) - restriction: >= netstandard2.0 - Fake.Core.Environment (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.FakeVar (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.UserInput (5.23) - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Core.Xml (5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.DotNet.AssemblyInfoFile (5.23) - Fake.Core.Environment (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.DotNet.Cli (5.23) - Fake.Core.Environment (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Process (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - Fake.DotNet.MSBuild (>= 5.23) - restriction: >= netstandard2.0 - Fake.DotNet.NuGet (>= 5.23) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Mono.Posix.NETStandard (>= 1.0) - restriction: >= netstandard2.0 - Newtonsoft.Json (>= 13.0.1) - restriction: >= netstandard2.0 - Fake.DotNet.MSBuild (5.23) - BlackFox.VsWhere (>= 1.1) - restriction: >= netstandard2.0 - Fake.Core.Environment (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Process (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - MSBuild.StructuredLogger (>= 2.1.545) - restriction: >= netstandard2.0 - Fake.DotNet.NuGet (5.23) - restriction: >= netstandard2.0 - Fake.Core.Environment (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Process (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.SemVer (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Tasks (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Xml (>= 5.23) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (>= 5.23) - restriction: >= netstandard2.0 - Fake.Net.Http (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Newtonsoft.Json (>= 13.0.1) - restriction: >= netstandard2.0 - NuGet.Protocol (>= 5.11) - restriction: >= netstandard2.0 - Fake.DotNet.Paket (5.23) - Fake.Core.Process (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - Fake.DotNet.Cli (>= 5.23) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (5.23) - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.IO.Zip (5.23) - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Net.Http (5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - Fake.Tools.Git (5.23) - Fake.Core.Environment (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Process (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.SemVer (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.String (>= 5.23) - restriction: >= netstandard2.0 - Fake.Core.Trace (>= 5.23) - restriction: >= netstandard2.0 - Fake.IO.FileSystem (>= 5.23) - restriction: >= netstandard2.0 - FSharp.Core (>= 6.0) - restriction: >= netstandard2.0 - FParsec (1.1.1) - restriction: >= netstandard2.0 - FSharp.Core (>= 4.3.4) - restriction: || (>= net45) (>= netstandard2.0) - System.ValueTuple (>= 4.4) - restriction: >= net45 - FSharp.Control.Reactive (5.0.5) - restriction: >= netstandard2.0 - FSharp.Core (>= 4.7.2) - restriction: >= netstandard2.0 - System.Reactive (>= 5.0 < 6.0) - restriction: >= netstandard2.0 - FSharp.Core (6.0.5) - restriction: >= netstandard2.0 - Microsoft.Bcl.AsyncInterfaces (6.0) - restriction: || (&& (>= net461) (>= net6.0)) (>= net472) (&& (>= net6.0) (< netcoreapp3.1)) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net461) (&& (>= netstandard2.0) (< netstandard2.1)) - Microsoft.Build (17.2) - Microsoft.Build.Framework (>= 17.2) - restriction: || (>= net472) (>= net6.0) - Microsoft.IO.Redist (>= 6.0) - restriction: >= net472 - Microsoft.NET.StringTools (>= 1.0) - restriction: || (>= net472) (>= net6.0) - Microsoft.Win32.Registry (>= 4.3) - restriction: >= net6.0 - System.Collections.Immutable (>= 5.0) - restriction: || (>= net472) (>= net6.0) - System.Configuration.ConfigurationManager (>= 4.7) - restriction: || (>= net472) (>= net6.0) - System.Memory (>= 4.5.4) - restriction: >= net472 - System.Reflection.Metadata (>= 1.6) - restriction: >= net6.0 - System.Security.Principal.Windows (>= 4.7) - restriction: >= net6.0 - System.Text.Encoding.CodePages (>= 4.0.1) - restriction: >= net6.0 - System.Text.Json (>= 6.0) - restriction: || (>= net472) (>= net6.0) - System.Threading.Tasks.Dataflow (>= 6.0) - restriction: || (>= net472) (>= net6.0) - Microsoft.Build.Framework (17.2) - restriction: >= netstandard2.0 - Microsoft.Win32.Registry (>= 4.3) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: >= net472 - System.Security.Permissions (>= 4.7) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - Microsoft.Build.Tasks.Core (17.2) - restriction: >= netstandard2.0 - Microsoft.Build.Framework (>= 17.2) - restriction: >= netstandard2.0 - Microsoft.Build.Utilities.Core (>= 17.2) - restriction: >= netstandard2.0 - Microsoft.IO.Redist (>= 6.0) - restriction: >= net472 - Microsoft.NET.StringTools (>= 1.0) - restriction: >= netstandard2.0 - Microsoft.Win32.Registry (>= 4.3) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.CodeDom (>= 4.4) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Collections.Immutable (>= 5.0) - restriction: >= netstandard2.0 - System.Reflection.Metadata (>= 1.6) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Resources.Extensions (>= 4.6) - restriction: >= netstandard2.0 - System.Security.Cryptography.Pkcs (>= 4.7) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Security.Cryptography.Xml (>= 4.7) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Security.Permissions (>= 4.7) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Threading.Tasks.Dataflow (>= 6.0) - restriction: >= netstandard2.0 - Microsoft.Build.Utilities.Core (17.2) - restriction: >= netstandard2.0 - Microsoft.Build.Framework (>= 17.2) - restriction: >= netstandard2.0 - Microsoft.IO.Redist (>= 6.0) - restriction: >= net472 - Microsoft.NET.StringTools (>= 1.0) - restriction: >= netstandard2.0 - Microsoft.Win32.Registry (>= 4.3) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Collections.Immutable (>= 5.0) - restriction: >= netstandard2.0 - System.Configuration.ConfigurationManager (>= 4.7) - restriction: >= netstandard2.0 - System.Security.Permissions (>= 4.7) - restriction: && (< net472) (< net6.0) (>= netstandard2.0) - System.Text.Encoding.CodePages (>= 4.0.1) - restriction: && (< net472) (< net6.0) (>= netstandard2.0) - Microsoft.IO.Redist (6.0) - restriction: >= net472 - System.Buffers (>= 4.5.1) - restriction: >= net472 - System.Memory (>= 4.5.4) - restriction: >= net472 - Microsoft.NET.StringTools (1.0) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.4) - restriction: >= netstandard2.0 - System.Runtime.CompilerServices.Unsafe (>= 5.0) - restriction: >= netstandard2.0 - Microsoft.NETCore.Platforms (6.0.5) - restriction: || (&& (< monoandroid) (< net45) (< netcoreapp3.1) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (>= net6.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netcoreapp2.1) (>= netcoreapp3.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos)) - Microsoft.NETCore.Targets (5.0) - restriction: || (&& (< monoandroid) (< net45) (< netcoreapp3.1) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< net45) (< netstandard1.2) (>= netstandard2.0) (< win8)) (&& (< monoandroid) (< net45) (< netstandard1.3) (>= netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (< netstandard1.5) (>= netstandard2.0) (< win8) (< wpa81)) - Microsoft.Win32.Registry (5.0) - restriction: || (&& (< net45) (>= netstandard2.0)) (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - System.Security.AccessControl (>= 5.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.1) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - System.Security.Principal.Windows (>= 5.0) - restriction: || (&& (>= monoandroid) (< netstandard1.3)) (&& (< monoandroid) (>= netcoreapp2.0)) (>= monotouch) (&& (< net46) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (>= netcoreapp2.1) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - Microsoft.Win32.SystemEvents (6.0.1) - restriction: || (&& (>= net472) (>= netcoreapp3.1)) (>= net6.0) - Mono.Posix.NETStandard (1.0) - restriction: >= netstandard2.0 - MSBuild.StructuredLogger (2.1.669) - Microsoft.Build (>= 16.10) - restriction: >= netstandard2.0 - Microsoft.Build.Framework (>= 16.10) - restriction: >= netstandard2.0 - Microsoft.Build.Tasks.Core (>= 16.10) - restriction: >= netstandard2.0 - Microsoft.Build.Utilities.Core (>= 16.10) - restriction: >= netstandard2.0 - Newtonsoft.Json (13.0.1) - restriction: >= netstandard2.0 - NuGet.Common (6.3) - restriction: >= netstandard2.0 - NuGet.Frameworks (>= 6.3) - restriction: >= netstandard2.0 - NuGet.Configuration (6.3) - restriction: >= netstandard2.0 - NuGet.Common (>= 6.3) - restriction: >= netstandard2.0 - System.Security.Cryptography.ProtectedData (>= 4.4) - restriction: && (< net472) (>= netstandard2.0) - NuGet.Frameworks (6.3) - restriction: >= netstandard2.0 - NuGet.Packaging (6.3) - restriction: >= netstandard2.0 - Newtonsoft.Json (>= 13.0.1) - restriction: >= netstandard2.0 - NuGet.Configuration (>= 6.3) - restriction: >= netstandard2.0 - NuGet.Versioning (>= 6.3) - restriction: >= netstandard2.0 - System.Security.Cryptography.Cng (>= 5.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) - System.Security.Cryptography.Pkcs (>= 5.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net5.0) - NuGet.Protocol (6.3) - restriction: >= netstandard2.0 - NuGet.Packaging (>= 6.3) - restriction: >= netstandard2.0 - NuGet.Versioning (6.3) - restriction: >= netstandard2.0 - Octokit (0.48) - System.Buffers (4.5.1) - restriction: || (&& (>= monoandroid) (>= net6.0) (< netstandard1.3)) (&& (>= monotouch) (>= net6.0)) (&& (>= net461) (>= netstandard2.1)) (&& (< net461) (< net6.0) (>= netstandard2.0)) (&& (< net461) (>= netstandard2.0) (< netstandard2.1)) (>= net472) (&& (>= net6.0) (< netcoreapp2.0)) (&& (>= net6.0) (< netstandard2.1)) (&& (>= net6.0) (>= xamarinios)) (&& (>= net6.0) (>= xamarinmac)) (&& (>= net6.0) (>= xamarintvos)) (&& (>= net6.0) (>= xamarinwatchos)) (&& (< net6.0) (>= netstandard2.1)) - System.CodeDom (6.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Collections.Immutable (6.0) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.4) - restriction: || (>= net461) (&& (< net6.0) (>= netstandard2.0)) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Configuration.ConfigurationManager (6.0) - restriction: >= netstandard2.0 - System.Security.Cryptography.ProtectedData (>= 6.0) - restriction: || (&& (< net461) (>= netstandard2.0)) (>= net6.0) - System.Security.Permissions (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Drawing.Common (6.0) - restriction: || (&& (>= net472) (>= netcoreapp3.1)) (>= net6.0) - Microsoft.Win32.SystemEvents (>= 6.0) - restriction: >= netcoreapp3.1 - System.Formats.Asn1 (6.0) - restriction: || (&& (< net461) (>= netstandard2.0)) (&& (>= net6.0) (< xamarintvos) (< xamarinwatchos)) (&& (< net6.0) (>= netcoreapp3.1) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (&& (>= netcoreapp3.0) (< xamarintvos) (< xamarinwatchos)) (>= netstandard2.1) - System.Buffers (>= 4.5.1) - restriction: || (>= net461) (&& (< net6.0) (>= netstandard2.0)) - System.Memory (>= 4.5.4) - restriction: || (>= net461) (&& (< net6.0) (>= netstandard2.0)) - System.Memory (4.5.5) - restriction: || (&& (>= net6.0) (< netstandard2.1)) (>= netstandard2.0) - System.Buffers (>= 4.5.1) - restriction: || (&& (>= monoandroid) (< netstandard1.1)) (&& (< monoandroid) (< net45) (>= netstandard1.1) (< netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (< netstandard1.1) (>= portable-net45+win8+wpa81) (< win8)) (>= monotouch) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (&& (< netstandard1.1) (>= win8)) (&& (< netstandard2.0) (< uap10.1) (>= wpa81)) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - System.Numerics.Vectors (>= 4.5) - restriction: >= net461 - System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (>= monoandroid) (< netstandard1.1)) (&& (< monoandroid) (< net45) (>= netstandard1.1) (< netstandard2.0) (< win8) (< wpa81)) (&& (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1)) (&& (< monoandroid) (< netstandard1.1) (>= portable-net45+win8+wpa81) (< win8)) (>= monotouch) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.0) (>= netstandard2.0)) (>= net461) (&& (< netstandard1.1) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= uap10.1) (>= xamarinios) (>= xamarinmac) (>= xamarintvos) (>= xamarinwatchos) - System.Numerics.Vectors (4.5) - restriction: || (&& (>= net461) (>= net6.0)) (>= net472) (&& (>= net6.0) (< netcoreapp3.1)) - System.Reactive (5.0) - restriction: >= netstandard2.0 - System.Runtime.InteropServices.WindowsRuntime (>= 4.3) - restriction: && (< net472) (< netcoreapp3.1) (>= netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net472) (&& (< netcoreapp3.1) (>= netstandard2.0)) (>= uap10.1) - System.Reflection.Metadata (6.0.1) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Collections.Immutable (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Resources.Extensions (6.0) - restriction: >= netstandard2.0 - System.Memory (>= 4.5.4) - restriction: || (>= net461) (&& (< net6.0) (>= netstandard2.0)) - System.Runtime (4.3.1) - restriction: && (< monoandroid) (< net45) (< netcoreapp3.1) (>= netstandard2.0) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - Microsoft.NETCore.Platforms (>= 1.1.1) - restriction: || (&& (< monoandroid) (< net45) (>= netstandard1.0) (< netstandard1.2) (< win8) (< wp8)) (&& (< monoandroid) (< net45) (>= netstandard1.2) (< netstandard1.3) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard1.3) (< netstandard1.5) (< win8) (< wpa81)) (&& (< monotouch) (< net45) (>= netstandard1.5) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) - Microsoft.NETCore.Targets (>= 1.1.3) - restriction: || (&& (< monoandroid) (< net45) (>= netstandard1.0) (< netstandard1.2) (< win8) (< wp8)) (&& (< monoandroid) (< net45) (>= netstandard1.2) (< netstandard1.3) (< win8) (< wpa81)) (&& (< monoandroid) (< net45) (>= netstandard1.3) (< netstandard1.5) (< win8) (< wpa81)) (&& (< monotouch) (< net45) (>= netstandard1.5) (< win8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) - System.Runtime.CompilerServices.Unsafe (6.0) - restriction: >= netstandard2.0 - System.Runtime.InteropServices.WindowsRuntime (4.3) - restriction: && (< net472) (< netcoreapp3.1) (>= netstandard2.0) - System.Runtime (>= 4.3) - restriction: && (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< win8) (< wp8) (< wpa81) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - System.Security.AccessControl (6.0) - restriction: >= netstandard2.0 - System.Security.Cryptography.Cng (5.0) - restriction: || (&& (< net461) (>= netstandard2.0) (< netstandard2.1)) (&& (< net472) (>= netstandard2.0)) (>= net5.0) (&& (>= net6.0) (< netcoreapp3.1)) (&& (>= net6.0) (< netstandard2.1)) (&& (< net6.0) (>= netcoreapp3.1)) (&& (< netcoreapp3.1) (>= netstandard2.1)) - Microsoft.NETCore.Platforms (>= 5.0) - restriction: && (< monoandroid) (>= netcoreapp2.0) (< netcoreapp2.1) (< netstandard2.1) (< xamarintvos) (< xamarinwatchos) - System.Formats.Asn1 (>= 5.0) - restriction: && (>= netcoreapp3.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos) - System.Security.Cryptography.Pkcs (6.0.1) - restriction: || (&& (< net461) (>= netstandard2.0)) (&& (< net472) (>= netstandard2.0)) (>= net5.0) - System.Buffers (>= 4.5.1) - restriction: && (< net461) (>= netstandard2.0) (< netstandard2.1) - System.Formats.Asn1 (>= 6.0) - restriction: || (&& (< net461) (>= netstandard2.0)) (>= netstandard2.1) - System.Memory (>= 4.5.4) - restriction: && (< net461) (>= netstandard2.0) (< netstandard2.1) - System.Security.Cryptography.Cng (>= 5.0) - restriction: || (&& (< net461) (>= netstandard2.0) (< netstandard2.1)) (&& (< net6.0) (>= netcoreapp3.1)) (&& (< netcoreapp3.1) (>= netstandard2.1)) - System.Security.Cryptography.ProtectedData (6.0) - restriction: || (&& (< net461) (>= net472)) (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Security.Cryptography.Xml (6.0.1) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Memory (>= 4.5.4) - restriction: && (< net461) (< net6.0) (>= netstandard2.0) - System.Security.AccessControl (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Security.Cryptography.Pkcs (>= 6.0.1) - restriction: || (&& (< net461) (>= netstandard2.0)) (>= net6.0) - System.Security.Permissions (6.0) - restriction: >= netstandard2.0 - System.Security.AccessControl (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Windows.Extensions (>= 6.0) - restriction: >= netcoreapp3.1 - System.Security.Principal.Windows (5.0) - restriction: >= net6.0 - System.Text.Encoding.CodePages (6.0) - restriction: || (&& (< net472) (>= netstandard2.0)) (>= net6.0) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Text.Encodings.Web (6.0) - restriction: || (>= net472) (>= net6.0) - System.Buffers (>= 4.5.1) - restriction: || (>= net461) (&& (< netcoreapp3.1) (>= netstandard2.0)) - System.Memory (>= 4.5.4) - restriction: || (>= net461) (&& (< netcoreapp3.1) (>= netstandard2.0)) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Text.Json (6.0.5) - restriction: || (>= net472) (>= net6.0) - Microsoft.Bcl.AsyncInterfaces (>= 6.0) - restriction: || (>= net461) (&& (< netcoreapp3.1) (>= netstandard2.0)) - System.Buffers (>= 4.5.1) - restriction: || (>= net461) (&& (< netcoreapp3.1) (>= netstandard2.0)) - System.Memory (>= 4.5.4) - restriction: || (>= net461) (&& (< netcoreapp3.1) (>= netstandard2.0)) - System.Numerics.Vectors (>= 4.5) - restriction: || (>= net461) (&& (< netcoreapp3.1) (>= netstandard2.0)) - System.Runtime.CompilerServices.Unsafe (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Text.Encodings.Web (>= 6.0) - restriction: || (>= net461) (>= netstandard2.0) - System.Threading.Tasks.Extensions (>= 4.5.4) - restriction: || (>= net461) (&& (< netcoreapp3.1) (>= netstandard2.0)) - System.ValueTuple (>= 4.5) - restriction: >= net461 - System.Threading.Tasks.Dataflow (6.0) - restriction: >= netstandard2.0 - System.Threading.Tasks.Extensions (4.5.4) - restriction: || (&& (>= net461) (>= net6.0)) (>= net472) (&& (>= net6.0) (< netcoreapp3.1)) (&& (< netcoreapp3.1) (>= netstandard2.0)) (&& (>= netstandard2.0) (>= uap10.1)) - System.Runtime.CompilerServices.Unsafe (>= 4.5.3) - restriction: || (&& (< monoandroid) (< monotouch) (< net45) (>= netstandard1.0) (< netstandard2.0) (< win8) (< wpa81) (< xamarintvos) (< xamarinwatchos)) (&& (< monoandroid) (< netstandard1.0) (>= portable-net45+win8+wp8+wpa81) (< win8)) (&& (>= net45) (< netstandard2.0)) (&& (< net45) (< netcoreapp2.1) (>= netstandard2.0) (< xamarinios) (< xamarinmac) (< xamarintvos) (< xamarinwatchos)) (>= net461) (&& (< netstandard1.0) (>= win8)) (&& (< netstandard2.0) (>= wpa81)) (>= wp8) - System.ValueTuple (4.5) - restriction: || (&& (>= net45) (>= netstandard2.0)) (&& (>= net461) (>= net6.0)) (>= net472) - System.Windows.Extensions (6.0) - restriction: || (&& (>= net472) (>= netcoreapp3.1)) (>= net6.0) - System.Drawing.Common (>= 6.0) - restriction: >= netcoreapp3.1 diff --git a/src/FsAutoComplete.Core/AbstractClassStubGenerator.fs b/src/FsAutoComplete.Core/AbstractClassStubGenerator.fs index ca3118161..1d6efbf4d 100644 --- a/src/FsAutoComplete.Core/AbstractClassStubGenerator.fs +++ b/src/FsAutoComplete.Core/AbstractClassStubGenerator.fs @@ -14,19 +14,19 @@ type AbstractClassData = member x.AbstractTypeIdentRange = match x with - | ObjExpr (baseTy, _, _) - | ExplicitImpl (baseTy, _, _) -> baseTy.Range + | ObjExpr(baseTy, _, _) + | ExplicitImpl(baseTy, _, _) -> baseTy.Range member x.TypeParameters = match x with - | ObjExpr (t, _, _) - | ExplicitImpl (t, _, _) -> expandTypeParameters t + | ObjExpr(t, _, _) + | ExplicitImpl(t, _, _) -> expandTypeParameters t /// checks to see if a type definition inherits an abstract class, and if so collects the members defined at that -let private walkTypeDefn (SynTypeDefn (info, repr, members, implicitCtor, range, trivia)) = +let private walkTypeDefn (SynTypeDefn(info, repr, members, implicitCtor, range, trivia)) = let reprMembers = match repr with - | SynTypeDefnRepr.ObjectModel (_, members, _) -> members + | SynTypeDefnRepr.ObjectModel(_, members, _) -> members | _ -> [] let allMembers = reprMembers @ (Option.toList implicitCtor) @ members @@ -34,7 +34,7 @@ let private walkTypeDefn (SynTypeDefn (info, repr, members, implicitCtor, range, let inheritMember = allMembers |> List.tryPick (function - | SynMemberDefn.ImplicitInherit (inheritType, inheritArgs, alias, range) -> Some(inheritType) + | SynMemberDefn.ImplicitInherit(inheritType, inheritArgs, alias, range) -> Some(inheritType) | _ -> None) let otherMembers = @@ -43,8 +43,8 @@ let private walkTypeDefn (SynTypeDefn (info, repr, members, implicitCtor, range, |> List.filter (function | SynMemberDefn.ImplicitCtor _ | SynMemberDefn.ImplicitInherit _ -> false - | SynMemberDefn.Member (SynBinding(valData = SynValData (Some ({ MemberKind = SynMemberKind.Constructor }), _, _)), - _) -> false + | SynMemberDefn.Member(SynBinding(valData = SynValData(Some({ MemberKind = SynMemberKind.Constructor }), _, _)), _) -> + false | _ -> true) match inheritMember with @@ -68,13 +68,13 @@ let private tryFindAbstractClassExprInParsedInput { new SyntaxVisitorBase<_>() with member _.VisitExpr(path, traverseExpr, defaultTraverse, expr) = match expr with - | SynExpr.ObjExpr (baseTy, constructorArgs, withKeyword, bindings, members, extraImpls, newExprRange, range) -> + | SynExpr.ObjExpr(baseTy, constructorArgs, withKeyword, bindings, members, extraImpls, newExprRange, range) -> Some(AbstractClassData.ObjExpr(baseTy, bindings, range)) | _ -> defaultTraverse expr override _.VisitModuleDecl(_, defaultTraverse, decl) = match decl with - | SynModuleDecl.Types (types, m) -> List.tryPick walkTypeDefn types + | SynModuleDecl.Types(types, m) -> List.tryPick walkTypeDefn types | _ -> defaultTraverse decl } ) @@ -103,14 +103,14 @@ let getAbstractClassIdentifier (abstractClassData: AbstractClassData) tokens = let getMemberNameAndRanges (abstractClassData) = match abstractClassData with - | AbstractClassData.ExplicitImpl (ty, members, _) -> + | AbstractClassData.ExplicitImpl(ty, members, _) -> members |> Seq.choose (function - | (SynMemberDefn.Member (binding, _)) -> Some binding + | (SynMemberDefn.Member(binding, _)) -> Some binding | _ -> None) |> Seq.choose (|MemberNameAndRange|_|) |> Seq.toList - | AbstractClassData.ObjExpr (_, bindings, _) -> List.choose (|MemberNameAndRange|_|) bindings + | AbstractClassData.ObjExpr(_, bindings, _) -> List.choose (|MemberNameAndRange|_|) bindings /// Try to find the start column, so we know what the base indentation should be let inferStartColumn @@ -129,7 +129,7 @@ let inferStartColumn | AbstractClassData.ExplicitImpl _ -> // 'interface ISomething with' is often in a new line, we use the indentation of that line getLineIdent lineStr + indentSize - | AbstractClassData.ObjExpr (_, _, newExprRange) -> + | AbstractClassData.ObjExpr(_, _, newExprRange) -> match codeGenServer.TokenizeLine(doc.FullName, pos.Line) with | Some tokens -> tokens @@ -188,7 +188,7 @@ let writeAbstractClassStub match abstractClassData with | AbstractClassData.ObjExpr _ -> findLastPositionOfWithKeyword tokens entity pos (getAbstractClassIdentifier abstractClassData) - | AbstractClassData.ExplicitImpl (_, _, safeInsertPosition) -> Some(false, safeInsertPosition) + | AbstractClassData.ExplicitImpl(_, _, safeInsertPosition) -> Some(false, safeInsertPosition) | None -> None let desiredMemberNamesWithRanges = getMemberNameAndRanges abstractClassData @@ -222,7 +222,7 @@ let writeAbstractClassStub return! None else match insertInfo with - | Some (shouldAppendWith, insertPosition) -> + | Some(shouldAppendWith, insertPosition) -> if shouldAppendWith then return! Some(insertPosition, " with" + generatedString) else diff --git a/src/FsAutoComplete.Core/CodeGeneration.fs b/src/FsAutoComplete.Core/CodeGeneration.fs index b5e9056dd..2efa9ba7a 100644 --- a/src/FsAutoComplete.Core/CodeGeneration.fs +++ b/src/FsAutoComplete.Core/CodeGeneration.fs @@ -43,7 +43,7 @@ type CodeGenerationService(checker: FSharpCompilerServiceChecker, state: State) override x.GetSymbolAtPosition(fileName, pos: Position) = match state.TryGetFileCheckerOptionsWithLinesAndLineStr(fileName, pos) with | ResultOrString.Error _ -> None - | ResultOrString.Ok (opts, lines, line) -> + | ResultOrString.Ok(opts, lines, line) -> try Lexer.getSymbol pos.Line pos.Column line SymbolLookupKind.Fuzzy [||] with _ -> @@ -56,7 +56,7 @@ type CodeGenerationService(checker: FSharpCompilerServiceChecker, state: State) if symbol.Kind = kind then match state.TryGetFileCheckerOptionsWithLinesAndLineStr(fileName, pos) with | ResultOrString.Error _ -> return! None - | ResultOrString.Ok (opts, text, line) -> + | ResultOrString.Ok(opts, text, line) -> let! result = checker.TryGetRecentCheckResultsForFile(fileName, opts, text) let symbolUse = result.TryGetSymbolUse pos line return! Some(symbol, symbolUse) @@ -67,7 +67,7 @@ type CodeGenerationService(checker: FSharpCompilerServiceChecker, state: State) override x.ParseFileInProject(fileName) = match state.TryGetFileCheckerOptionsWithLines fileName with | ResultOrString.Error _ -> None - | ResultOrString.Ok (opts, text) -> + | ResultOrString.Ok(opts, text) -> try checker.TryGetRecentCheckResultsForFile(fileName, opts, text) |> Option.map (fun n -> n.GetParseResults) @@ -278,17 +278,17 @@ module CodeGenerationUtils = let args, namesWithIndices = args |> List.fold - (fun (argsSoFar: string list list, namesWithIndices) args -> - let argsSoFar', namesWithIndices = - args - |> List.fold - (fun (acc: string list, allNames) arg -> - let name, allNames = formatArgUsage ctx hasTypeAnnotation allNames arg - name :: acc, allNames) - ([], namesWithIndices) - - List.rev argsSoFar' :: argsSoFar, namesWithIndices) - ([], Map.ofList [ ctx.ObjectIdent, Set.empty ]) + (fun (argsSoFar: string list list, namesWithIndices) args -> + let argsSoFar', namesWithIndices = + args + |> List.fold + (fun (acc: string list, allNames) arg -> + let name, allNames = formatArgUsage ctx hasTypeAnnotation allNames arg + name :: acc, allNames) + ([], namesWithIndices) + + List.rev argsSoFar' :: argsSoFar, namesWithIndices) + ([], Map.ofList [ ctx.ObjectIdent, Set.empty ]) args |> List.rev @@ -313,7 +313,7 @@ module CodeGenerationUtils = let argInfos, retType = match argInfos, v.IsPropertyGetterMethod, v.IsPropertySetterMethod with - | [ AllAndLast (args, last) ], _, true -> [ args ], Some last.Type + | [ AllAndLast(args, last) ], _, true -> [ args ], Some last.Type | [ [] ], true, _ -> [], Some retType | _, _, _ -> argInfos, Some retType @@ -440,7 +440,7 @@ module CodeGenerationUtils = if m.IsDispatchSlot then "override " else "member " match m with - | MemberInfo.PropertyGetSet (getter, setter) -> + | MemberInfo.PropertyGetSet(getter, setter) -> let (usage, modifiers, getterArgInfos, retType) = preprocess ctx getter let closeDeclaration = closeDeclaration retType let writeImplementation = writeImplementation ctx @@ -558,7 +558,7 @@ module CodeGenerationUtils = let (|TypeOfMember|_|) (m: FSharpMemberOrFunctionOrValue) = match m.FullTypeSafe with - | Some (MemberFunctionType typ) when m.IsProperty && m.DeclaringEntity.IsSome && m.DeclaringEntity.Value.IsFSharp -> + | Some(MemberFunctionType typ) when m.IsProperty && m.DeclaringEntity.IsSome && m.DeclaringEntity.Value.IsFSharp -> Some typ | Some typ -> Some typ | None -> None @@ -640,7 +640,7 @@ module CodeGenerationUtils = let (|LongIdentPattern|_|) = function - | SynPat.LongIdent(longDotId = LongIdentWithDots (xs, _)) -> + | SynPat.LongIdent(longDotId = LongIdentWithDots(xs, _)) -> // let (name, range) = xs |> List.map (fun x -> x.idText, x.idRange) |> List.last let last = List.last xs Some(last.idText, last.idRange) @@ -651,21 +651,21 @@ module CodeGenerationUtils = // so we use 'get_' and 'set_' prefix to ensure corresponding symbols are retrieved correctly. let (|MemberNameAndRange|_|) = function - | SynBinding (valData = SynValData (Some mf, _, _); headPat = LongIdentPattern (name, range)) when + | SynBinding(valData = SynValData(Some mf, _, _); headPat = LongIdentPattern(name, range)) when mf.MemberKind = SynMemberKind.PropertyGet -> if name.StartsWith("get_") then Some(name, range) else Some("get_" + name, range) - | SynBinding (valData = SynValData (Some mf, _, _); headPat = LongIdentPattern (name, range)) when + | SynBinding(valData = SynValData(Some mf, _, _); headPat = LongIdentPattern(name, range)) when mf.MemberKind = SynMemberKind.PropertySet -> if name.StartsWith("set_") then Some(name, range) else Some("set_" + name, range) - | SynBinding(headPat = LongIdentPattern (name, range)) -> Some(name, range) + | SynBinding(headPat = LongIdentPattern(name, range)) -> Some(name, range) | _ -> None let normalizeEventName (m: FSharpMemberOrFunctionOrValue) = @@ -815,8 +815,8 @@ module CodeGenerationUtils = (displayContext: FSharpDisplayContext) excludedMemberSignatures (e: FSharpEntity) - (getMembersToImplement: FSharpEntity - -> seq>) + (getMembersToImplement: + FSharpEntity -> seq>) verboseMode = let lines = String.getLines methodBody @@ -923,17 +923,17 @@ module CodeGenerationUtils = let rec (|RationalConst|) = function | SynRationalConst.Integer i -> string i - | SynRationalConst.Rational (numerator, denominator, _) -> sprintf "(%i/%i)" numerator denominator - | SynRationalConst.Negate (RationalConst s) -> sprintf "- %s" s + | SynRationalConst.Rational(numerator, denominator, _) -> sprintf "(%i/%i)" numerator denominator + | SynRationalConst.Negate(RationalConst s) -> sprintf "- %s" s let rec (|TypeIdent|_|) = function - | SynType.Var (SynTypar (s, req, _), _) -> + | SynType.Var(SynTypar(s, req, _), _) -> match req with | TyparStaticReq.None -> Some("'" + s.idText) | TyparStaticReq.HeadType -> Some("^" + s.idText) - | SynType.LongIdent (LongIdentWithDots (xs, _)) -> xs |> Seq.map (fun x -> x.idText) |> String.concat "." |> Some - | SynType.App (t, _, ts, _, _, isPostfix, _) -> + | SynType.LongIdent(LongIdentWithDots(xs, _)) -> xs |> Seq.map (fun x -> x.idText) |> String.concat "." |> Some + | SynType.App(t, _, ts, _, _, isPostfix, _) -> match t, ts with | TypeIdent typeName, [] -> Some typeName | TypeIdent typeName, [ TypeIdent typeArg ] -> @@ -952,15 +952,15 @@ module CodeGenerationUtils = debug "Unsupported case with %A and %A" t ts None | SynType.Anon _ -> Some "_" - | SynType.Tuple (_, ts, _) -> Some(ts |> Seq.choose (snd >> (|TypeIdent|_|)) |> String.concat " * ") - | SynType.Array (dimension, TypeIdent typeName, _) -> Some(sprintf "%s [%s]" typeName (String(',', dimension - 1))) - | SynType.MeasurePower (TypeIdent typeName, RationalConst power, _) -> Some(sprintf "%s^%s" typeName power) - | SynType.MeasureDivide (TypeIdent numerator, TypeIdent denominator, _) -> + | SynType.Tuple(_, ts, _) -> Some(ts |> Seq.choose (snd >> (|TypeIdent|_|)) |> String.concat " * ") + | SynType.Array(dimension, TypeIdent typeName, _) -> Some(sprintf "%s [%s]" typeName (String(',', dimension - 1))) + | SynType.MeasurePower(TypeIdent typeName, RationalConst power, _) -> Some(sprintf "%s^%s" typeName power) + | SynType.MeasureDivide(TypeIdent numerator, TypeIdent denominator, _) -> Some(sprintf "%s/%s" numerator denominator) | _ -> None let expandTypeParameters (typ: SynType) = match typ with - | SynType.App (_, _, ts, _, _, _, _) - | SynType.LongIdentApp (_, _, _, ts, _, _, _) -> ts |> Seq.choose (|TypeIdent|_|) |> Seq.toArray + | SynType.App(_, _, ts, _, _, _, _) + | SynType.LongIdentApp(_, _, _, ts, _, _, _) -> ts |> Seq.choose (|TypeIdent|_|) |> Seq.toArray | _ -> [||] diff --git a/src/FsAutoComplete.Core/Commands.fs b/src/FsAutoComplete.Core/Commands.fs index 3433211fd..77ea78e56 100644 --- a/src/FsAutoComplete.Core/Commands.fs +++ b/src/FsAutoComplete.Core/Commands.fs @@ -23,7 +23,6 @@ open SymbolLocation open FSharp.Compiler.Symbols open System.Collections.Immutable open System.Collections.Generic -open Ionide.ProjInfo.ProjectSystem [] @@ -228,7 +227,7 @@ module Commands = match res with | None -> return CoreResponse.InfoRes "Record at position not found" - | Some (recordEpr, (Some recordDefinition), insertionPos) -> + | Some(recordEpr, (Some recordDefinition), insertionPos) -> if shouldGenerateRecordStub recordEpr recordDefinition then let result = formatRecord insertionPos "$1" recordDefinition recordEpr.FieldExprList return CoreResponse.Res(result, insertionPos.InsertionPos) @@ -241,7 +240,7 @@ module Commands = async { match Lexer.findLongIdents (pos.Column, line) with | None -> return CoreResponse.InfoRes "Ident not found" - | Some (_, idents) -> + | Some(_, idents) -> match ParsedInput.GetEntityKind(pos, tyRes.GetParseResults.ParseTree) with | None -> return CoreResponse.InfoRes "EntityKind not found" | Some entityKind -> @@ -350,7 +349,7 @@ module Commands = match res with | None -> return CoreResponse.InfoRes "Union at position not found" - | Some (patMatchExpr, unionTypeDefinition, insertionPos) -> + | Some(patMatchExpr, unionTypeDefinition, insertionPos) -> if shouldGenerateUnionPatternMatchCases patMatchExpr unionTypeDefinition then let result = formatMatchExpr insertionPos "$1" patMatchExpr unionTypeDefinition @@ -419,7 +418,7 @@ module Commands = let formatDocument (tryGetFileCheckerOptionsWithLines: _ -> Result) - (formatDocumentAsync: _ -> System.Threading.Tasks.Task) + (formatDocumentAsync: FormatDocumentRequest -> System.Threading.Tasks.Task) (file: string) : Async> = asyncResult { @@ -488,7 +487,7 @@ module Commands = async { match tyRes.TryGetSymbolUseAndUsages pos lineStr with - | Ok (sym, usages) -> + | Ok(sym, usages) -> let fsym = sym.Symbol if fsym.IsPrivateToFile then @@ -505,11 +504,12 @@ module Commands = } let renameSymbol - (symbolUseWorkspace: _ - -> _ - -> _ - -> _ - -> Async * Dictionary, Dictionary>, string>>) + (symbolUseWorkspace: + _ + -> _ + -> _ + -> _ + -> Async * Dictionary, Dictionary>, string>>) (tryGetFileSource: _ -> Result) (pos: Position) (tyRes: ParseAndCheckResults) @@ -518,35 +518,35 @@ module Commands = = asyncResult { match! symbolUseWorkspace pos lineStr text tyRes with - | Choice1Of2 (declarationsByDocument, symbolUsesByDocument) -> + | Choice1Of2(declarationsByDocument, symbolUsesByDocument) -> let totalSetOfRanges = Dictionary() - for (KeyValue (filePath, declUsages)) in declarationsByDocument do + for (KeyValue(filePath, declUsages)) in declarationsByDocument do let! text = tryGetFileSource (UMX.tag filePath) match totalSetOfRanges.TryGetValue(text) with | true, ranges -> totalSetOfRanges[text] <- Array.append ranges declUsages | false, _ -> totalSetOfRanges[text] <- declUsages - for (KeyValue (filePath, symbolUses)) in symbolUsesByDocument do + for (KeyValue(filePath, symbolUses)) in symbolUsesByDocument do let! text = tryGetFileSource (UMX.tag filePath) match totalSetOfRanges.TryGetValue(text) with | true, ranges -> totalSetOfRanges[text] <- Array.append ranges symbolUses | false, _ -> totalSetOfRanges[text] <- symbolUses - return totalSetOfRanges |> Seq.map (fun (KeyValue (k, v)) -> k, v) |> Array.ofSeq - | Choice2Of2 (mixedDeclarationAndSymbolUsesByDocument) -> + return totalSetOfRanges |> Seq.map (fun (KeyValue(k, v)) -> k, v) |> Array.ofSeq + | Choice2Of2(mixedDeclarationAndSymbolUsesByDocument) -> let totalSetOfRanges = Dictionary() - for (KeyValue (filePath, symbolUses)) in mixedDeclarationAndSymbolUsesByDocument do + for (KeyValue(filePath, symbolUses)) in mixedDeclarationAndSymbolUsesByDocument do let! text = tryGetFileSource (UMX.tag filePath) match totalSetOfRanges.TryGetValue(text) with | true, ranges -> totalSetOfRanges[text] <- Array.append ranges symbolUses | false, _ -> totalSetOfRanges[text] <- symbolUses - return totalSetOfRanges |> Seq.map (fun (KeyValue (k, v)) -> k, v) |> Array.ofSeq + return totalSetOfRanges |> Seq.map (fun (KeyValue(k, v)) -> k, v) |> Array.ofSeq } let typesig (tyRes: ParseAndCheckResults) (pos: Position) lineStr = @@ -613,7 +613,7 @@ module Commands = return CoreResponse.Res hints } - |> Result.fold id (fun _ -> CoreResponse.InfoRes "Couldn't find file content") + |> Result.bimap id (fun _ -> CoreResponse.InfoRes "Couldn't find file content") let calculateNamespaceInsert currentAst @@ -661,8 +661,8 @@ module Commands = // adjust column let pos = match pos with - | Pos (1, c) -> pos - | Pos (l, 0) -> + | Pos(1, c) -> pos + | Pos(l, 0) -> let prev = getLine (pos.DecLine()) let indentation = detectIndentation prev @@ -671,7 +671,7 @@ module Commands = Position.mkPos l indentation else pos - | Pos (_, c) -> pos + | Pos(_, c) -> pos { Namespace = n Position = pos @@ -765,14 +765,14 @@ module Commands = return Choice1Of2(declarationRanges, usageRanges) - | SymbolDeclarationLocation.Projects (projects, isInternalToProject) -> + | SymbolDeclarationLocation.Projects(projects, isInternalToProject) -> let symbolUseRanges = ImmutableArray.CreateBuilder() let symbolRange = symbol.DefinitionRange.NormalizeDriveLetterCasing() let symbolFile = symbolRange.TaggedFileName - let symbolFileText = + let! symbolFileText = tryGetFileSource (symbolFile) - |> Result.fold id (fun e -> failwith $"Unable to get file source for file '{symbolFile}'") + |> Result.mapError (fun e -> failwith $"Unable to get file source for file '{symbolFile}'") let! symbolText = symbolFileText.[symbolRange] // |> Result.fold id (fun e -> failwith "Unable to get text for initial symbol use") @@ -790,7 +790,7 @@ module Commands = |> List.distinctBy (fun x -> x.ProjectFileName) let onFound (symbolUseRange: range) = - async { + asyncResult { let symbolUseRange = symbolUseRange.NormalizeDriveLetterCasing() let symbolFile = symbolUseRange.TaggedFileName let targetText = tryGetFileSource (symbolFile) @@ -798,9 +798,9 @@ module Commands = match targetText with | Error e -> () | Ok sourceText -> - let sourceSpan = + let! sourceSpan = sourceText.[symbolUseRange] - |> Result.fold id (fun e -> failwith "Unable to get text for symbol use") + |> Result.mapError (fun e -> failwith "Unable to get text for symbol use") // There are two kinds of ranges we get back: // * ranges that exactly match the short name of the symbol @@ -821,6 +821,7 @@ module Commands = let actualUseRange = Range.mkRange symbolUseRange.FileName startPos endPos symbolUseRanges.Add actualUseRange } + |> Async.Ignore let! _ = getSymbolUsesInProjects (symbol, projects, onFound) @@ -1181,11 +1182,11 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: disposables.Add <| state.ProjectController.Notifications.Subscribe(fun ev -> match ev with - | ProjectResponse.Project (p, isFromCache) -> + | ProjectResponse.Project(p, isFromCache) -> if not isFromCache then p.ProjectItems |> List.choose (function - | ProjectViewerItem.Compile (p, _) -> Some(Utils.normalizePath p)) + | ProjectViewerItem.Compile(p, _) -> Some(Utils.normalizePath p)) |> parseFilesInTheBackground |> Async.Start else @@ -1368,7 +1369,7 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: member x.TryGetRecentTypeCheckResultsForFile(file: string) = match state.TryGetFileCheckerOptionsWithLines file with - | Ok (opts, text) -> x.TryGetRecentTypeCheckResultsForFile(file, opts, text) + | Ok(opts, text) -> x.TryGetRecentTypeCheckResultsForFile(file, opts, text) | _ -> async.Return None member x.TryGetRecentTypeCheckResultsForFile(file, opts, text) = @@ -1413,7 +1414,7 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: let! projectOptions = match state.ScriptProjectOptions.TryFind file with - | Some (h, opts) when h = hash -> async.Return opts + | Some(h, opts) when h = hash -> async.Return opts | _ -> async { let! projectOptions = checker.GetProjectOptionsFromScript(file, text, fsiRefs) @@ -1569,7 +1570,9 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: | ResultOrString.Ok text -> let files = Array.singleton (UMX.untag file) - let parseOptions = { FSharpParsingOptions.Default with SourceFiles = files } + let parseOptions = + { FSharpParsingOptions.Default with + SourceFiles = files } let! decls = checker.GetDeclarations(file, text, parseOptions, version) let decls = decls |> Array.map (fun a -> a, file) @@ -1577,12 +1580,14 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: | ResultOrString.Error _, Some text -> let files = Array.singleton (UMX.untag file) - let parseOptions = { FSharpParsingOptions.Default with SourceFiles = files } + let parseOptions = + { FSharpParsingOptions.Default with + SourceFiles = files } let! decls = checker.GetDeclarations(file, text, parseOptions, version) let decls = decls |> Array.map (fun a -> a, file) return CoreResponse.Res decls - | ResultOrString.Ok (checkOptions, text), _ -> + | ResultOrString.Ok(checkOptions, text), _ -> let parseOptions = Utils.projectOptionsToParseOptions checkOptions let! decls = checker.GetDeclarations(file, text, parseOptions, version) @@ -1597,7 +1602,7 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: async { let decls = state.NavigationDeclarations.ToArray() - |> Array.collect (fun (KeyValue (p, decls)) -> decls |> Array.map (fun d -> d, p)) + |> Array.collect (fun (KeyValue(p, decls)) -> decls |> Array.map (fun d -> d, p)) return CoreResponse.Res decls } @@ -1619,7 +1624,7 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: match state.Declarations.TryFind sym with | None -> //Isn't in sync filled cache, we don't have result return CoreResponse.ErrorRes(sprintf "No help text available for symbol '%s'" sym) - | Some (decl, pos, fn) -> //Is in sync filled cache, try to get results from async filled caches or calculate if it's not there + | Some(decl, pos, fn) -> //Is in sync filled cache, try to get results from async filled caches or calculate if it's not there let source = state.Files.TryFind fn |> Option.map (fun n -> n.Lines) match source with @@ -1666,7 +1671,7 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: let! res = tyRes.TryGetCompletions pos lineStr filter getAllSymbols match res with - | Some (decls, residue, shouldKeywords) -> + | Some(decls, residue, shouldKeywords) -> let declName (d: DeclarationListItem) = d.Name //Init cache for current list @@ -2049,11 +2054,7 @@ type Commands(checker: FSharpCompilerServiceChecker, state: State, hasAnalyzers: let formatDocumentAsync x = fantomasService.FormatDocumentAsync x Commands.formatDocument tryGetFileCheckerOptionsWithLines formatDocumentAsync file - member x.FormatSelection - ( - file: string, - rangeToFormat: FormatSelectionRange - ) : Async> = + member x.FormatSelection(file: string, rangeToFormat: FormatSelectionRange) : Async> = let tryGetFileCheckerOptionsWithLines file = x.TryGetFileCheckerOptionsWithLines file |> Result.map snd diff --git a/src/FsAutoComplete.Core/CompilerServiceInterface.fs b/src/FsAutoComplete.Core/CompilerServiceInterface.fs index d983c3037..e8a92535b 100644 --- a/src/FsAutoComplete.Core/CompilerServiceInterface.fs +++ b/src/FsAutoComplete.Core/CompilerServiceInterface.fs @@ -56,7 +56,8 @@ type FSharpCompilerServiceChecker(hasAnalyzers) = opt.EndsWith "FSharp.Core.dll" || opt.EndsWith "FSharp.Compiler.Interactive.Settings.dll") - { p with OtherOptions = Array.append otherOpts [| $"-r:%s{fsc.FullName}"; $"-r:%s{fsi.FullName}" |] } + { p with + OtherOptions = Array.append otherOpts [| $"-r:%s{fsc.FullName}"; $"-r:%s{fsi.FullName}" |] } let (|StartsWith|_|) (prefix: string) (s: string) = if s.StartsWith(prefix) then @@ -90,7 +91,8 @@ type FSharpCompilerServiceChecker(hasAnalyzers) = badRefs |> List.exists (fun r -> s.EndsWith r) fun (projOptions: FSharpProjectOptions) -> - { projOptions with OtherOptions = projOptions.OtherOptions |> Array.where (containsBadRef >> not) } + { projOptions with + OtherOptions = projOptions.OtherOptions |> Array.where (containsBadRef >> not) } /// ensures that any user-configured include/load files are added to the typechecking context let addLoadedFiles (projectOptions: FSharpProjectOptions) = @@ -101,7 +103,8 @@ type FSharpCompilerServiceChecker(hasAnalyzers) = >> Log.addContextDestructured "files" files ) - { projectOptions with SourceFiles = files } + { projectOptions with + SourceFiles = files } let (|Reference|_|) (opt: string) = if opt.StartsWith "-r:" then Some(opt.[3..]) else None @@ -256,7 +259,7 @@ type FSharpCompilerServiceChecker(hasAnalyzers) = ) return ResultOrString.Error(sprintf "Check aborted (%A). Errors: %A" c parseErrors) - | FSharpCheckFileAnswer.Succeeded (c) -> + | FSharpCheckFileAnswer.Succeeded(c) -> checkerLogger.info ( Log.setMessage "{opName} completed successfully" >> Log.addContextDestructured "opName" opName @@ -305,11 +308,11 @@ type FSharpCompilerServiceChecker(hasAnalyzers) = match FSharpCompilerServiceChecker.GetDependingProjects file options with | None -> return [||] - | Some (opts, []) -> + | Some(opts, []) -> let opts = clearProjectReferences opts let! res = checker.ParseAndCheckProject opts return res.GetUsesOfSymbol symbol - | Some (opts, dependentProjects) -> + | Some(opts, dependentProjects) -> let! res = opts :: dependentProjects |> List.map (fun (opts) -> diff --git a/src/FsAutoComplete.Core/Decompiler.fs b/src/FsAutoComplete.Core/Decompiler.fs index 021eb6fde..25c62a019 100644 --- a/src/FsAutoComplete.Core/Decompiler.fs +++ b/src/FsAutoComplete.Core/Decompiler.fs @@ -84,7 +84,7 @@ let resolveType (typeSystem: IDecompilerTypeSystem) (typeName: string) = let rec formatExtTypeFullName externalType = match externalType with - | FindDeclExternalType.Type (name, genericArgs) -> + | FindDeclExternalType.Type(name, genericArgs) -> (match genericArgs with | [] -> "" | args -> @@ -102,8 +102,8 @@ let areSameTypes (typeArguments: IReadOnlyList) ((mParam, paramSym): IPar let parameterTypeFullName = typeArguments |> Seq.fold - (fun (str: string) t -> str.Replace(t.ReflectionName, t.Name)) - (mParam.Type.ReflectionName.Trim([| '&'; ' ' |])) + (fun (str: string) t -> str.Replace(t.ReflectionName, t.Name)) + (mParam.Type.ReflectionName.Trim([| '&'; ' ' |])) let extTypeFullName = formatExtTypeFullName extType parameterTypeFullName = extTypeFullName @@ -116,12 +116,12 @@ let areSameTypes (typeArguments: IReadOnlyList) ((mParam, paramSym): IPar let getDeclaringTypeName = function - | FindDeclExternalSymbol.Type (fullName) -> fullName - | FindDeclExternalSymbol.Constructor (typeName, _args) -> typeName - | FindDeclExternalSymbol.Method (typeName, _name, _paramSyms, _genericArity) -> typeName - | FindDeclExternalSymbol.Field (typeName, _name) -> typeName - | FindDeclExternalSymbol.Event (typeName, _name) -> typeName - | FindDeclExternalSymbol.Property (typeName, _name) -> typeName + | FindDeclExternalSymbol.Type(fullName) -> fullName + | FindDeclExternalSymbol.Constructor(typeName, _args) -> typeName + | FindDeclExternalSymbol.Method(typeName, _name, _paramSyms, _genericArity) -> typeName + | FindDeclExternalSymbol.Field(typeName, _name) -> typeName + | FindDeclExternalSymbol.Event(typeName, _name) -> typeName + | FindDeclExternalSymbol.Property(typeName, _name) -> typeName let findMethodFromArgs (args: FindDeclExternalParam list) (methods: IMethod seq) = methods @@ -155,28 +155,28 @@ let decompile (externalSym: FindDeclExternalSymbol) assemblyPath : Result Some(typeDef :> ISymbol) - | FindDeclExternalSymbol.Constructor (_typeName, args) -> + | FindDeclExternalSymbol.Constructor(_typeName, args) -> typeDef.GetConstructors() |> findMethodFromArgs args |> Option.map (fun x -> x :> ISymbol) - | FindDeclExternalSymbol.Method (_typeName, name, args, genericArity) -> + | FindDeclExternalSymbol.Method(_typeName, name, args, genericArity) -> typeDef.GetMethods(filter = Predicate(fun m -> m.Name = name)) |> Seq.where (fun m -> m.TypeParameters.Count = genericArity) |> findMethodFromArgs args |> Option.map (fun x -> x :> ISymbol) - | FindDeclExternalSymbol.Field (_typeName, name) -> + | FindDeclExternalSymbol.Field(_typeName, name) -> typeDef.GetFields(filter = Predicate(fun m -> m.Name = name)) |> Seq.tryHead |> Option.map (fun x -> x :> ISymbol) - | FindDeclExternalSymbol.Event (_typeName, name) -> + | FindDeclExternalSymbol.Event(_typeName, name) -> typeDef.GetEvents(filter = Predicate(fun m -> m.Name = name)) |> Seq.tryHead |> Option.map (fun x -> x :> ISymbol) - | FindDeclExternalSymbol.Property (_typeName, name) -> + | FindDeclExternalSymbol.Property(_typeName, name) -> typeDef.GetProperties(filter = Predicate(fun m -> m.Name = name)) |> Seq.tryHead |> Option.map (fun x -> x :> ISymbol) diff --git a/src/FsAutoComplete.Core/DocumentationFormatter.fs b/src/FsAutoComplete.Core/DocumentationFormatter.fs index d9b03f2f1..5690d1d47 100644 --- a/src/FsAutoComplete.Core/DocumentationFormatter.fs +++ b/src/FsAutoComplete.Core/DocumentationFormatter.fs @@ -129,7 +129,7 @@ module DocumentationFormatter = let memberConstraint (c: FSharpGenericParameterMemberConstraint) = let formattedMemberName, isProperty = match c.IsProperty, PrettyNaming.TryChopPropertyName c.MemberName with - | true, Some (chopped) when chopped <> c.MemberName -> chopped, true + | true, Some(chopped) when chopped <> c.MemberName -> chopped, true | _, _ -> if PrettyNaming.IsMangledOpName c.MemberName then PrettyNaming.DecompileOpName c.MemberName, false @@ -791,7 +791,7 @@ module DocumentationFormatter = sprintf "Full name: %s\nDeclaring Entity: %s\nAssembly: %s" m.SafeFullName link m.Assembly.SimpleName - | SymbolUse.Entity (c, _) -> + | SymbolUse.Entity(c, _) -> match c.DeclaringEntity with | None -> sprintf "Full name: %s\nAssembly: %s" c.SafeFullName c.Assembly.SimpleName | Some e -> @@ -822,9 +822,9 @@ module DocumentationFormatter = match entity with | MemberFunctionOrValue m -> sprintf "Full name: %s\nAssembly: %s" m.SafeFullName m.Assembly.SimpleName - | EntityFromSymbol (c, _) -> sprintf "Full name: %s\nAssembly: %s" c.SafeFullName c.Assembly.SimpleName + | EntityFromSymbol(c, _) -> sprintf "Full name: %s\nAssembly: %s" c.SafeFullName c.Assembly.SimpleName - | Field (f, _) -> sprintf "Full name: %s\nAssembly: %s" f.SafeFullName f.Assembly.SimpleName + | Field(f, _) -> sprintf "Full name: %s\nAssembly: %s" f.SafeFullName f.Assembly.SimpleName | ActivePatternCase ap -> sprintf "Full name: %s\nAssembly: %s" ap.SafeFullName ap.Assembly.SimpleName @@ -851,19 +851,19 @@ module DocumentationFormatter = lastDisplayContext <- symbol.DisplayContext match symbol with - | SymbolUse.TypeAbbreviation (fse) -> + | SymbolUse.TypeAbbreviation(fse) -> try let parent = fse.GetAbbreviatedParent() match parent with - | FSharpEntity (ent, _, _) -> + | FSharpEntity(ent, _, _) -> let signature = getEntitySignature symbol.DisplayContext ent Some(signature, footerForType' parent, cn) | _ -> None with _ -> None - | SymbolUse.Entity (fse, _) -> + | SymbolUse.Entity(fse, _) -> try let signature = getEntitySignature symbol.DisplayContext fse Some(signature, footerForType symbol, cn) @@ -944,7 +944,7 @@ module DocumentationFormatter = let cn = compiledNameType' symbol match symbol with - | EntityFromSymbol (fse, _) -> + | EntityFromSymbol(fse, _) -> try let signature = getEntitySignature lastDisplayContext fse Some(signature, footerForType' symbol, cn) @@ -984,7 +984,7 @@ module DocumentationFormatter = let signature = getValSignature lastDisplayContext func Some((signature, emptyTypeTip), footerForType' symbol, cn) - | Field (fsf, _) -> + | Field(fsf, _) -> let signature = getFieldSignature lastDisplayContext fsf Some((signature, emptyTypeTip), footerForType' symbol, cn) diff --git a/src/FsAutoComplete.Core/FCSPatches.fs b/src/FsAutoComplete.Core/FCSPatches.fs index 8a4f72b78..b65983588 100644 --- a/src/FsAutoComplete.Core/FCSPatches.fs +++ b/src/FsAutoComplete.Core/FCSPatches.fs @@ -11,9 +11,9 @@ open FSharp.Compiler.CodeAnalysis module internal SynExprAppLocationsImpl = let rec private searchSynArgExpr traverseSynExpr expr ranges = match expr with - | SynExpr.Const (SynConst.Unit, _) -> None, None + | SynExpr.Const(SynConst.Unit, _) -> None, None - | SynExpr.Paren (SynExpr.Tuple (_, exprs, _commas, _tupRange), _, _, _parenRange) -> + | SynExpr.Paren(SynExpr.Tuple(_, exprs, _commas, _tupRange), _, _, _parenRange) -> let rec loop (exprs: SynExpr list) ranges = match exprs with | [] -> ranges @@ -22,11 +22,11 @@ module internal SynExprAppLocationsImpl = let res = loop exprs ranges Some(res), None - | SynExpr.Paren (SynExpr.Paren (_, _, _, _) as synExpr, _, _, _parenRange) -> + | SynExpr.Paren(SynExpr.Paren(_, _, _, _) as synExpr, _, _, _parenRange) -> let r, _cacheOpt = searchSynArgExpr traverseSynExpr synExpr ranges r, None - | SynExpr.Paren (SynExpr.App (_, _isInfix, _, _, _range), _, _, parenRange) -> Some(parenRange :: ranges), None + | SynExpr.Paren(SynExpr.App(_, _isInfix, _, _, _range), _, _, parenRange) -> Some(parenRange :: ranges), None | e -> let inner = traverseSynExpr e @@ -42,10 +42,10 @@ module internal SynExprAppLocationsImpl = { new SyntaxVisitorBase<_>() with member _.VisitExpr(_path, traverseSynExpr, defaultTraverse, expr) = match expr with - | SynExpr.App (_exprAtomicFlag, _isInfix, funcExpr, argExpr, range) when Position.posEq pos range.Start -> + | SynExpr.App(_exprAtomicFlag, _isInfix, funcExpr, argExpr, range) when Position.posEq pos range.Start -> let isInfixFuncExpr = match funcExpr with - | SynExpr.App (_, isInfix, _, _, _) -> isInfix + | SynExpr.App(_, isInfix, _, _, _) -> isInfix | _ -> false if isInfixFuncExpr then @@ -78,14 +78,14 @@ type FSharpParseFileResults with override __.VisitBinding(_, _, binding) = match binding with - | SynBinding (valData = valData; range = ((ContainsPos pos) as range)) -> + | SynBinding(valData = valData; range = ((ContainsPos pos) as range)) -> let info = valData.SynValInfo.CurriedArgInfos let mutable found = false for group in info do for arg in group do match arg.Ident with - | Some (IdentContainsPos pos) -> found <- true + | Some(IdentContainsPos pos) -> found <- true | _ -> () if found then Some range else None @@ -98,11 +98,11 @@ type FSharpParseFileResults with /// reused pattern to find applications of => (a symptom of improper C# style lambdas) let (|InfixAppOfOpEqualsGreater|_|) = function - | SynExpr.App (ExprAtomicFlag.NonAtomic, - false, - SynExpr.App (ExprAtomicFlag.NonAtomic, true, Ident "op_EqualsGreater", actualParamListExpr, _), - actualLambdaBodyExpr, - _) -> Some(actualParamListExpr, actualLambdaBodyExpr) + | SynExpr.App(ExprAtomicFlag.NonAtomic, + false, + SynExpr.App(ExprAtomicFlag.NonAtomic, true, Ident "op_EqualsGreater", actualParamListExpr, _), + actualLambdaBodyExpr, + _) -> Some(actualParamListExpr, actualLambdaBodyExpr) | _ -> None @@ -110,13 +110,13 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.Paren ((InfixAppOfOpEqualsGreater (lambdaArgs, lambdaBody) as app), _, _, _) -> + | SynExpr.Paren((InfixAppOfOpEqualsGreater(lambdaArgs, lambdaBody) as app), _, _, _) -> Some(app.Range, lambdaArgs.Range, lambdaBody.Range) | _ -> defaultTraverse expr member _.VisitBinding(_, defaultTraverse, binding) = match binding with - | SynBinding (kind = SynBindingKind.Normal; expr = InfixAppOfOpEqualsGreater (lambdaArgs, lambdaBody) as app) -> + | SynBinding(kind = SynBindingKind.Normal; expr = InfixAppOfOpEqualsGreater(lambdaArgs, lambdaBody) as app) -> Some(app.Range, lambdaArgs.Range, lambdaBody.Range) | _ -> defaultTraverse binding } @@ -129,7 +129,7 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.App (_, false, SynExpr.Ident funcIdent, expr, _) -> + | SynExpr.App(_, false, SynExpr.Ident funcIdent, expr, _) -> if funcIdent.idText = "op_Dereference" && Range.rangeContainsPos expr.Range expressionPos @@ -147,7 +147,7 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.Record (_, _, _, range) when Range.rangeContainsPos range pos -> Some range + | SynExpr.Record(_, _, _, range) when Range.rangeContainsPos range pos -> Some range | _ -> defaultTraverse expr } ) @@ -158,8 +158,8 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member __.VisitExpr(_path, _, defaultTraverse, expr) = match expr with - | SynExpr.YieldOrReturn (_, expr, range) - | SynExpr.YieldOrReturnFrom (_, expr, range) when Range.rangeContainsPos range pos -> Some expr.Range + | SynExpr.YieldOrReturn(_, expr, range) + | SynExpr.YieldOrReturnFrom(_, expr, range) when Range.rangeContainsPos range pos -> Some expr.Range | _ -> defaultTraverse expr } ) @@ -172,7 +172,7 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.App (_, _, SynExpr.App (_, true, SynExpr.Ident ident, _, _), argExpr, _) when + | SynExpr.App(_, _, SynExpr.App(_, true, SynExpr.Ident ident, _, _), argExpr, _) when Range.rangeContainsPos argExpr.Range pos -> if ident.idText = "op_PipeRight" then Some(ident, 1) @@ -191,10 +191,10 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, traverseSynExpr, defaultTraverse, expr) = match expr with - | SynExpr.TypeApp (_, _, _, _, _, _, range) when Range.rangeContainsPos range pos -> Some range - | SynExpr.App (_, _, _, SynExpr.ComputationExpr (_, expr, _), range) when Range.rangeContainsPos range pos -> + | SynExpr.TypeApp(_, _, _, _, _, _, range) when Range.rangeContainsPos range pos -> Some range + | SynExpr.App(_, _, _, SynExpr.ComputationExpr(_, expr, _), range) when Range.rangeContainsPos range pos -> traverseSynExpr expr - | SynExpr.App (_, _, _, _, range) when Range.rangeContainsPos range pos -> Some range + | SynExpr.App(_, _, _, _, range) when Range.rangeContainsPos range pos -> Some range | _ -> defaultTraverse expr } ) @@ -206,28 +206,28 @@ type FSharpParseFileResults with match expr with | SynExpr.Ident ident -> Some ident.idRange - | SynExpr.LongIdent (_, _, _, range) -> Some range + | SynExpr.LongIdent(_, _, _, range) -> Some range - | SynExpr.Paren (expr, _, _, range) when Range.rangeContainsPos range pos -> + | SynExpr.Paren(expr, _, _, range) when Range.rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos - | SynExpr.TypeApp (expr, _, _, _, _, _, _) -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos + | SynExpr.TypeApp(expr, _, _, _, _, _, _) -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos - | SynExpr.App (_, _, funcExpr, argExpr, _) -> + | SynExpr.App(_, _, funcExpr, argExpr, _) -> match argExpr with - | SynExpr.App (_, _, _, _, range) when Range.rangeContainsPos range pos -> + | SynExpr.App(_, _, _, _, range) when Range.rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr argExpr pos // Special case: `async { ... }` is actually a CompExpr inside of the argExpr of a SynExpr.App - | SynExpr.ComputationExpr (_, expr, range) when Range.rangeContainsPos range pos -> + | SynExpr.ComputationExpr(_, expr, range) when Range.rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos - | SynExpr.Paren (expr, _, _, range) when Range.rangeContainsPos range pos -> + | SynExpr.Paren(expr, _, _, range) when Range.rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos | _ -> match funcExpr with - | SynExpr.App (_, true, _, _, _) when Range.rangeContainsPos argExpr.Range pos -> + | SynExpr.App(_, true, _, _, _) when Range.rangeContainsPos argExpr.Range pos -> // x |> List.map // Don't dive into the funcExpr (the operator expr) // because we dont want to offer sig help for that! @@ -237,16 +237,16 @@ type FSharpParseFileResults with // of the identifier of the function we're after getIdentRangeForFuncExprInApp traverseSynExpr funcExpr pos - | SynExpr.LetOrUse (bindings = bindings; body = body; range = range) when Range.rangeContainsPos range pos -> + | SynExpr.LetOrUse(bindings = bindings; body = body; range = range) when Range.rangeContainsPos range pos -> let binding = bindings |> List.tryFind (fun x -> Range.rangeContainsPos x.RangeOfBindingWithRhs pos) match binding with - | Some (SynBinding (expr = expr)) -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos + | Some(SynBinding(expr = expr)) -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos | None -> getIdentRangeForFuncExprInApp traverseSynExpr body pos - | SynExpr.IfThenElse (ifExpr = ifExpr; thenExpr = thenExpr; elseExpr = elseExpr; range = range) when + | SynExpr.IfThenElse(ifExpr = ifExpr; thenExpr = thenExpr; elseExpr = elseExpr; range = range) when Range.rangeContainsPos range pos -> if Range.rangeContainsPos ifExpr.Range pos then @@ -258,7 +258,7 @@ type FSharpParseFileResults with | None -> None | Some expr -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos - | SynExpr.Match (expr = expr; clauses = clauses; range = range) when Range.rangeContainsPos range pos -> + | SynExpr.Match(expr = expr; clauses = clauses; range = range) when Range.rangeContainsPos range pos -> if Range.rangeContainsPos expr.Range pos then getIdentRangeForFuncExprInApp traverseSynExpr expr pos else @@ -269,7 +269,7 @@ type FSharpParseFileResults with | None -> None | Some clause -> match clause with - | SynMatchClause (whenExpr = whenExpr; resultExpr = resultExpr) -> + | SynMatchClause(whenExpr = whenExpr; resultExpr = resultExpr) -> match whenExpr with | None -> getIdentRangeForFuncExprInApp traverseSynExpr resultExpr pos | Some whenExpr -> @@ -280,7 +280,7 @@ type FSharpParseFileResults with // Ex: C.M(x, y, ...) <--- We want to find where in the tupled application the call is being made - | SynExpr.Tuple (_, exprs, _, tupRange) when Range.rangeContainsPos tupRange pos -> + | SynExpr.Tuple(_, exprs, _, tupRange) when Range.rangeContainsPos tupRange pos -> let expr = exprs |> List.tryFind (fun expr -> Range.rangeContainsPos expr.Range pos) match expr with @@ -288,16 +288,16 @@ type FSharpParseFileResults with | Some expr -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos // Capture the body of a lambda, often nested in a call to a collection function - | SynExpr.Lambda (body = body) when Range.rangeContainsPos body.Range pos -> + | SynExpr.Lambda(body = body) when Range.rangeContainsPos body.Range pos -> getIdentRangeForFuncExprInApp traverseSynExpr body pos - | SynExpr.Do (expr, range) when Range.rangeContainsPos range pos -> + | SynExpr.Do(expr, range) when Range.rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos - | SynExpr.Assert (expr, range) when Range.rangeContainsPos range pos -> + | SynExpr.Assert(expr, range) when Range.rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos - | SynExpr.ArbitraryAfterError (_debugStr, range) when Range.rangeContainsPos range pos -> Some range + | SynExpr.ArbitraryAfterError(_debugStr, range) when Range.rangeContainsPos range pos -> Some range | expr -> traverseSynExpr expr |> Option.map (fun expr -> expr) @@ -308,9 +308,9 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, traverseSynExpr, defaultTraverse, expr) = match expr with - | SynExpr.TypeApp (expr, _, _, _, _, _, range) when Range.rangeContainsPos range pos -> + | SynExpr.TypeApp(expr, _, _, _, _, _, range) when Range.rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr expr pos - | SynExpr.App (_, _, _funcExpr, _, range) as app when Range.rangeContainsPos range pos -> + | SynExpr.App(_, _, _funcExpr, _, range) as app when Range.rangeContainsPos range pos -> getIdentRangeForFuncExprInApp traverseSynExpr app pos | _ -> defaultTraverse expr } ) @@ -327,7 +327,7 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.App (_, false, SynExpr.Ident funcIdent, expr, _) -> + | SynExpr.App(_, false, SynExpr.Ident funcIdent, expr, _) -> if funcIdent.idText = "op_Dereference" && Range.rangeContainsPos expr.Range expressionPos @@ -346,7 +346,7 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.InterpolatedString (range = range) when Range.rangeContainsPos range pos -> Some range + | SynExpr.InterpolatedString(range = range) when Range.rangeContainsPos range pos -> Some range | _ -> defaultTraverse expr } ) @@ -354,7 +354,7 @@ module SyntaxTreeOps = open FSharp.Compiler.Syntax let rec synExprContainsError inpExpr = - let rec walkBind (SynBinding (expr = expr)) = walkExpr expr + let rec walkBind (SynBinding(expr = expr)) = walkExpr expr and walkExprs es = es |> List.exists walkExpr @@ -362,7 +362,7 @@ module SyntaxTreeOps = and walkMatchClauses cl = cl - |> List.exists (fun (SynMatchClause (whenExpr = whenExpr; resultExpr = resultExpr)) -> + |> List.exists (fun (SynMatchClause(whenExpr = whenExpr; resultExpr = resultExpr)) -> walkExprOpt whenExpr || walkExpr resultExpr) and walkExprOpt eOpt = eOpt |> Option.exists walkExpr @@ -382,112 +382,113 @@ module SyntaxTreeOps = | SynExpr.ImplicitZero _ | SynExpr.Const _ -> false - | SynExpr.TypeTest (e, _, _) - | SynExpr.Upcast (e, _, _) - | SynExpr.AddressOf (_, e, _, _) - | SynExpr.ComputationExpr (_, e, _) - | SynExpr.ArrayOrListComputed (_, e, _) - | SynExpr.Typed (e, _, _) - | SynExpr.FromParseError (e, _) - | SynExpr.Do (e, _) - | SynExpr.Assert (e, _) - | SynExpr.DotGet (e, _, _, _) - | SynExpr.LongIdentSet (_, e, _) - | SynExpr.New (_, _, e, _) - | SynExpr.TypeApp (e, _, _, _, _, _, _) - | SynExpr.LibraryOnlyUnionCaseFieldGet (e, _, _, _) - | SynExpr.Downcast (e, _, _) - | SynExpr.InferredUpcast (e, _) - | SynExpr.InferredDowncast (e, _) - | SynExpr.Lazy (e, _) - | SynExpr.TraitCall (_, _, e, _) - | SynExpr.YieldOrReturn (_, e, _) - | SynExpr.YieldOrReturnFrom (_, e, _) - | SynExpr.DoBang (e, _) - | SynExpr.Fixed (e, _) - | SynExpr.Paren (e, _, _, _) -> walkExpr e - - | SynExpr.NamedIndexedPropertySet (_, e1, e2, _) - | SynExpr.DotSet (e1, _, e2, _) - | SynExpr.Set (e1, e2, _) - | SynExpr.LibraryOnlyUnionCaseFieldSet (e1, _, _, e2, _) - | SynExpr.JoinIn (e1, _, e2, _) - | SynExpr.App (_, _, e1, e2, _) -> walkExpr e1 || walkExpr e2 - - | SynExpr.ArrayOrList (_, es, _) - | SynExpr.Tuple (_, es, _, _) -> walkExprs es - - | SynExpr.AnonRecd (copyInfo = copyInfo; recordFields = recordFields) -> + | SynExpr.TypeTest(e, _, _) + | SynExpr.Upcast(e, _, _) + | SynExpr.AddressOf(_, e, _, _) + | SynExpr.ComputationExpr(_, e, _) + | SynExpr.ArrayOrListComputed(_, e, _) + | SynExpr.Typed(e, _, _) + | SynExpr.FromParseError(e, _) + | SynExpr.Do(e, _) + | SynExpr.Assert(e, _) + | SynExpr.DotGet(e, _, _, _) + | SynExpr.LongIdentSet(_, e, _) + | SynExpr.New(_, _, e, _) + | SynExpr.TypeApp(e, _, _, _, _, _, _) + | SynExpr.LibraryOnlyUnionCaseFieldGet(e, _, _, _) + | SynExpr.Downcast(e, _, _) + | SynExpr.InferredUpcast(e, _) + | SynExpr.InferredDowncast(e, _) + | SynExpr.Lazy(e, _) + | SynExpr.TraitCall(_, _, e, _) + | SynExpr.YieldOrReturn(_, e, _) + | SynExpr.YieldOrReturnFrom(_, e, _) + | SynExpr.DoBang(e, _) + | SynExpr.Fixed(e, _) + | SynExpr.Paren(e, _, _, _) -> walkExpr e + + | SynExpr.NamedIndexedPropertySet(_, e1, e2, _) + | SynExpr.DotSet(e1, _, e2, _) + | SynExpr.Set(e1, e2, _) + | SynExpr.LibraryOnlyUnionCaseFieldSet(e1, _, _, e2, _) + | SynExpr.JoinIn(e1, _, e2, _) + | SynExpr.App(_, _, e1, e2, _) -> walkExpr e1 || walkExpr e2 + + | SynExpr.ArrayOrList(_, es, _) + | SynExpr.Tuple(_, es, _, _) -> walkExprs es + + | SynExpr.AnonRecd(copyInfo = copyInfo; recordFields = recordFields) -> (match copyInfo with - | Some (e, _) -> walkExpr e + | Some(e, _) -> walkExpr e | None -> false) || walkExprs (recordFields |> List.map (fun (ident, range, expr) -> expr)) - | SynExpr.Record (copyInfo = copyInfo; recordFields = recordFields) -> + | SynExpr.Record(copyInfo = copyInfo; recordFields = recordFields) -> (match copyInfo with - | Some (e, _) -> walkExpr e + | Some(e, _) -> walkExpr e | None -> false) || let flds = - recordFields |> List.choose (fun (SynExprRecordField (expr = expr)) -> expr) in + recordFields |> List.choose (fun (SynExprRecordField(expr = expr)) -> expr) in + walkExprs flds - | SynExpr.ObjExpr (bindings = bindings; extraImpls = extraImpls) -> + | SynExpr.ObjExpr(bindings = bindings; extraImpls = extraImpls) -> walkBinds bindings || walkBinds - [ for (SynInterfaceImpl (bindings = bindings)) in extraImpls do - yield! bindings ] + [ for (SynInterfaceImpl(bindings = bindings)) in extraImpls do + yield! bindings ] - | SynExpr.ForEach (enumExpr = e1; bodyExpr = e2) - | SynExpr.While (whileExpr = e1; doExpr = e2) -> walkExpr e1 || walkExpr e2 + | SynExpr.ForEach(enumExpr = e1; bodyExpr = e2) + | SynExpr.While(whileExpr = e1; doExpr = e2) -> walkExpr e1 || walkExpr e2 - | SynExpr.For (identBody = e1; toBody = e2; doBody = e3) -> walkExpr e1 || walkExpr e2 || walkExpr e3 + | SynExpr.For(identBody = e1; toBody = e2; doBody = e3) -> walkExpr e1 || walkExpr e2 || walkExpr e3 - | SynExpr.MatchLambda (matchClauses = cl) -> walkMatchClauses cl + | SynExpr.MatchLambda(matchClauses = cl) -> walkMatchClauses cl - | SynExpr.Lambda (body = body) -> walkExpr body + | SynExpr.Lambda(body = body) -> walkExpr body - | SynExpr.Match (expr = e; clauses = cl) -> walkExpr e || walkMatchClauses cl + | SynExpr.Match(expr = e; clauses = cl) -> walkExpr e || walkMatchClauses cl - | SynExpr.LetOrUse (bindings = bs; body = e) -> walkBinds bs || walkExpr e + | SynExpr.LetOrUse(bindings = bs; body = e) -> walkBinds bs || walkExpr e - | SynExpr.TryWith (tryExpr = e; withCases = cl) -> walkExpr e || walkMatchClauses cl + | SynExpr.TryWith(tryExpr = e; withCases = cl) -> walkExpr e || walkMatchClauses cl - | SynExpr.TryFinally (tryExpr = e1; finallyExpr = e2) -> walkExpr e1 || walkExpr e2 + | SynExpr.TryFinally(tryExpr = e1; finallyExpr = e2) -> walkExpr e1 || walkExpr e2 - | SynExpr.Sequential (_, _, e1, e2, _) -> walkExpr e1 || walkExpr e2 + | SynExpr.Sequential(_, _, e1, e2, _) -> walkExpr e1 || walkExpr e2 - | SynExpr.SequentialOrImplicitYield (_, e1, e2, _, _) -> walkExpr e1 || walkExpr e2 + | SynExpr.SequentialOrImplicitYield(_, e1, e2, _, _) -> walkExpr e1 || walkExpr e2 - | SynExpr.IfThenElse (ifExpr = e1; thenExpr = e2; elseExpr = e3opt) -> + | SynExpr.IfThenElse(ifExpr = e1; thenExpr = e2; elseExpr = e3opt) -> walkExpr e1 || walkExpr e2 || walkExprOpt e3opt - | SynExpr.DotIndexedGet (e1, es, _, _) -> walkExpr e1 || walkExpr es + | SynExpr.DotIndexedGet(e1, es, _, _) -> walkExpr e1 || walkExpr es - | SynExpr.DotIndexedSet (e1, es, e2, _, _, _) -> walkExpr e1 || walkExpr es || walkExpr e2 + | SynExpr.DotIndexedSet(e1, es, e2, _, _, _) -> walkExpr e1 || walkExpr es || walkExpr e2 - | SynExpr.DotNamedIndexedPropertySet (e1, _, e2, e3, _) -> walkExpr e1 || walkExpr e2 || walkExpr e3 + | SynExpr.DotNamedIndexedPropertySet(e1, _, e2, e3, _) -> walkExpr e1 || walkExpr e2 || walkExpr e3 - | SynExpr.MatchBang (expr = e; clauses = cl) -> walkExpr e || walkMatchClauses cl + | SynExpr.MatchBang(expr = e; clauses = cl) -> walkExpr e || walkMatchClauses cl - | SynExpr.LetOrUseBang (rhs = e1; body = e2; andBangs = es) -> + | SynExpr.LetOrUseBang(rhs = e1; body = e2; andBangs = es) -> walkExpr e1 || walkExprs - [ for (SynExprAndBang (body = e)) in es do - yield e ] + [ for (SynExprAndBang(body = e)) in es do + yield e ] || walkExpr e2 - | SynExpr.InterpolatedString (parts, _, _m) -> + | SynExpr.InterpolatedString(parts, _, _m) -> walkExprs ( parts |> List.choose (function | SynInterpolatedStringPart.String _ -> None - | SynInterpolatedStringPart.FillExpr (x, _) -> Some x) + | SynInterpolatedStringPart.FillExpr(x, _) -> Some x) ) - | SynExpr.IndexRange (expr1, opm, expr2, range1, range2, range3) -> + | SynExpr.IndexRange(expr1, opm, expr2, range1, range2, range3) -> Option.map walkExpr expr1 |> Option.orElseWith (fun _ -> Option.map walkExpr expr2) |> Option.defaultValue false - | SynExpr.IndexFromEnd (expr, range) -> walkExpr expr - | SynExpr.DebugPoint (innerExpr = expr) -> walkExpr expr + | SynExpr.IndexFromEnd(expr, range) -> walkExpr expr + | SynExpr.DebugPoint(innerExpr = expr) -> walkExpr expr walkExpr inpExpr diff --git a/src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj b/src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj index 81ddede39..449e81272 100644 --- a/src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj +++ b/src/FsAutoComplete.Core/FsAutoComplete.Core.fsproj @@ -44,5 +44,16 @@ - + + + + + + + + + + + + diff --git a/src/FsAutoComplete.Core/Fsdn.fs b/src/FsAutoComplete.Core/Fsdn.fs index bed4035c2..3a5a529ec 100644 --- a/src/FsAutoComplete.Core/Fsdn.fs +++ b/src/FsAutoComplete.Core/Fsdn.fs @@ -6,9 +6,12 @@ open Newtonsoft.Json let private httpClient = new System.Net.Http.HttpClient() type Response = - {| values: {| api: {| name: {| ``namespace``: string - class_name: string - id: string |} |} |}[] |} + {| values: + {| api: + {| name: + {| ``namespace``: string + class_name: string + id: string |} |} |}[] |} let query (querystr: string) = async { diff --git a/src/FsAutoComplete.Core/InlayHints.fs b/src/FsAutoComplete.Core/InlayHints.fs index b6bcb6ca5..ad69102f6 100644 --- a/src/FsAutoComplete.Core/InlayHints.fs +++ b/src/FsAutoComplete.Core/InlayHints.fs @@ -28,23 +28,23 @@ and private defaultTraversePat visitor origPath pat = let path = SyntaxNode.SynPat pat :: origPath match pat with - | SynPat.Paren (p, _) -> traversePat visitor path p - | SynPat.As (p1, p2, _) - | SynPat.Or (p1, p2, _, _) -> [ p1; p2 ] |> List.tryPick (traversePat visitor path) - | SynPat.Ands (ps, _) - | SynPat.Tuple (_, ps, _) - | SynPat.ArrayOrList (_, ps, _) -> ps |> List.tryPick (traversePat visitor path) - | SynPat.Attrib (p, _, _) -> traversePat visitor path p - | SynPat.LongIdent (argPats = args) -> + | SynPat.Paren(p, _) -> traversePat visitor path p + | SynPat.As(p1, p2, _) + | SynPat.Or(p1, p2, _, _) -> [ p1; p2 ] |> List.tryPick (traversePat visitor path) + | SynPat.Ands(ps, _) + | SynPat.Tuple(_, ps, _) + | SynPat.ArrayOrList(_, ps, _) -> ps |> List.tryPick (traversePat visitor path) + | SynPat.Attrib(p, _, _) -> traversePat visitor path p + | SynPat.LongIdent(argPats = args) -> match args with | SynArgPats.Pats ps -> ps |> List.tryPick (traversePat visitor path) - | SynArgPats.NamePatPairs (ps, _) -> + | SynArgPats.NamePatPairs(ps, _) -> ps |> List.map (fun (_, _, pat) -> pat) |> List.tryPick (traversePat visitor path) - | SynPat.Typed (p, _ty, _) -> traversePat visitor path p + | SynPat.Typed(p, _ty, _) -> traversePat visitor path p // no access to `traverseSynType` -> no traversing into `ty` - | SynPat.Record (fieldPats = fieldPats) -> + | SynPat.Record(fieldPats = fieldPats) -> fieldPats |> List.map (fun (_, _, pat) -> pat) |> List.tryPick (traversePat visitor path) @@ -98,7 +98,7 @@ type private FSharp.Compiler.CodeAnalysis.FSharpParseFileResults with { new SyntaxVisitorBase<_>() with override _.VisitExpr(_path, _traverseSynExpr, defaultTraverse, expr) = match expr with - | SynExpr.Typed (_expr, _typeExpr, range) when Position.posEq range.Start pos -> Some range + | SynExpr.Typed(_expr, _typeExpr, range) when Position.posEq range.Start pos -> Some range | _ -> defaultTraverse expr override _.VisitSimplePats(_path, pats) = @@ -107,21 +107,21 @@ type private FSharp.Compiler.CodeAnalysis.FSharpParseFileResults with | _ -> let exprFunc pat = match pat with - | SynSimplePat.Typed (_pat, _targetExpr, range) when Position.posEq range.Start pos -> Some range + | SynSimplePat.Typed(_pat, _targetExpr, range) when Position.posEq range.Start pos -> Some range | _ -> None pats |> List.tryPick exprFunc override visitor.VisitPat(path, defaultTraverse, pat) = match pat with - | SynPat.Typed (_pat, _targetType, range) when Position.posEq range.Start pos -> Some range + | SynPat.Typed(_pat, _targetType, range) when Position.posEq range.Start pos -> Some range | _ -> defaultTraversePat visitor path pat override _.VisitBinding(_path, defaultTraverse, binding) = match binding with - | SynBinding (headPat = SynPat.Named (range = patRange) - returnInfo = Some (SynBindingReturnInfo(typeName = SynType.LongIdent (idents)))) -> - Some patRange + | SynBinding( + headPat = SynPat.Named(range = patRange) + returnInfo = Some(SynBindingReturnInfo(typeName = SynType.LongIdent(idents)))) -> Some patRange | _ -> defaultTraverse binding } let result = SyntaxTraversal.Traverse(pos, x.ParseTree, visitor) @@ -462,16 +462,16 @@ let rec private isDirectlyTyped (identStart: Position) (path: SyntaxVisitorPath) //ENHANCEMENT: handle SynExpr.Typed? -> not at binding, but usage match path with | [] -> false - | SyntaxNode.SynPat (SynPat.Typed (pat = pat)) :: _ when rangeContainsPos pat.Range identStart -> true - | SyntaxNode.SynPat (SynPat.Paren _) :: path -> isDirectlyTyped identStart path - | SyntaxNode.SynPat (SynPat.Attrib (pat = pat)) :: path when rangeContainsPos pat.Range identStart -> + | SyntaxNode.SynPat(SynPat.Typed(pat = pat)) :: _ when rangeContainsPos pat.Range identStart -> true + | SyntaxNode.SynPat(SynPat.Paren _) :: path -> isDirectlyTyped identStart path + | SyntaxNode.SynPat(SynPat.Attrib(pat = pat)) :: path when rangeContainsPos pat.Range identStart -> isDirectlyTyped identStart path - | SyntaxNode.SynBinding (SynBinding (headPat = headPat; returnInfo = Some (SynBindingReturnInfo _))) :: _ when + | SyntaxNode.SynBinding(SynBinding(headPat = headPat; returnInfo = Some(SynBindingReturnInfo _))) :: _ when rangeContainsPos headPat.Range identStart -> true - | SyntaxNode.SynExpr (SynExpr.Paren _) :: path -> isDirectlyTyped identStart path - | SyntaxNode.SynExpr (SynExpr.Typed (expr = expr)) :: _ when rangeContainsPos expr.Range identStart -> true + | SyntaxNode.SynExpr(SynExpr.Paren _) :: path -> isDirectlyTyped identStart path + | SyntaxNode.SynExpr(SynExpr.Typed(expr = expr)) :: _ when rangeContainsPos expr.Range identStart -> true | _ -> false /// Note: FULL range of pattern -> everything in parens @@ -479,26 +479,26 @@ let rec private isDirectlyTyped (identStart: Position) (path: SyntaxVisitorPath) /// `let private (a: int)` is not valid, must include private: `let (private a: int)` let rec private getParensForPatternWithIdent (patternRange: Range) (identStart: Position) (path: SyntaxVisitorPath) = match path with - | SyntaxNode.SynPat (SynPat.Paren _) :: _ -> + | SyntaxNode.SynPat(SynPat.Paren _) :: _ -> // (x) Parens.Exist patternRange - | SyntaxNode.SynBinding (SynBinding (headPat = headPat)) :: _ when rangeContainsPos headPat.Range identStart -> + | SyntaxNode.SynBinding(SynBinding(headPat = headPat)) :: _ when rangeContainsPos headPat.Range identStart -> // let x = Parens.Optional patternRange - | SyntaxNode.SynPat (SynPat.Tuple(isStruct = true)) :: _ -> + | SyntaxNode.SynPat(SynPat.Tuple(isStruct = true)) :: _ -> // struct (x,y) Parens.Optional patternRange - | SyntaxNode.SynPat (SynPat.Tuple _) :: SyntaxNode.SynPat (SynPat.Paren _) :: _ -> + | SyntaxNode.SynPat(SynPat.Tuple _) :: SyntaxNode.SynPat(SynPat.Paren _) :: _ -> // (x,y) Parens.Optional patternRange - | SyntaxNode.SynPat (SynPat.Tuple _) :: _ -> + | SyntaxNode.SynPat(SynPat.Tuple _) :: _ -> // x,y Parens.Required patternRange - | SyntaxNode.SynPat (SynPat.ArrayOrList _) :: _ -> + | SyntaxNode.SynPat(SynPat.ArrayOrList _) :: _ -> // [x;y;z] Parens.Optional patternRange - | SyntaxNode.SynPat (SynPat.As _) :: SyntaxNode.SynPat (SynPat.Paren _) :: _ -> Parens.Optional patternRange - | SyntaxNode.SynPat (SynPat.As (rhsPat = pat)) :: SyntaxNode.SynBinding (SynBinding (headPat = headPat)) :: _ when + | SyntaxNode.SynPat(SynPat.As _) :: SyntaxNode.SynPat(SynPat.Paren _) :: _ -> Parens.Optional patternRange + | SyntaxNode.SynPat(SynPat.As(rhsPat = pat)) :: SyntaxNode.SynBinding(SynBinding(headPat = headPat)) :: _ when rangeContainsPos pat.Range identStart && rangeContainsPos headPat.Range identStart -> @@ -507,7 +507,7 @@ let rec private getParensForPatternWithIdent (patternRange: Range) (identStart: // let _ as value: int = // (new `: int` belongs to let binding, NOT as pattern) Parens.Optional patternRange - | SyntaxNode.SynPat (SynPat.As (lhsPat = pat)) :: SyntaxNode.SynBinding (SynBinding (headPat = headPat)) :: _ when + | SyntaxNode.SynPat(SynPat.As(lhsPat = pat)) :: SyntaxNode.SynBinding(SynBinding(headPat = headPat)) :: _ when rangeContainsPos pat.Range identStart && rangeContainsPos headPat.Range identStart -> @@ -516,31 +516,31 @@ let rec private getParensForPatternWithIdent (patternRange: Range) (identStart: // let (value: int) as _ = // (`: int` belongs to as pattern, but let bindings tries to parse type annotation eagerly -> without parens let binding finished after `: int` -> as not pattern) Parens.Required patternRange - | SyntaxNode.SynPat (SynPat.As (rhsPat = pat)) :: _ when rangeContainsPos pat.Range identStart -> + | SyntaxNode.SynPat(SynPat.As(rhsPat = pat)) :: _ when rangeContainsPos pat.Range identStart -> // _ as (value: int) Parens.Required patternRange - | SyntaxNode.SynPat (SynPat.As (lhsPat = pat)) :: _ when rangeContainsPos pat.Range identStart -> + | SyntaxNode.SynPat(SynPat.As(lhsPat = pat)) :: _ when rangeContainsPos pat.Range identStart -> // value: int as _ // ^^^^^^^^^^ unlike rhs this here doesn't require parens... Parens.Optional patternRange - | SyntaxNode.SynPat (SynPat.Record _) :: _ -> + | SyntaxNode.SynPat(SynPat.Record _) :: _ -> // { Value=value } Parens.Optional patternRange - | SyntaxNode.SynPat (SynPat.LongIdent(argPats = SynArgPats.NamePatPairs (range = range))) :: _ when + | SyntaxNode.SynPat(SynPat.LongIdent(argPats = SynArgPats.NamePatPairs(range = range))) :: _ when rangeContainsPos range identStart -> // U (Value=value) // ^ ^ // must exist to be valid Parens.Optional patternRange - | SyntaxNode.SynExpr (SynExpr.LetOrUseBang(isUse = true)) :: _ -> + | SyntaxNode.SynExpr(SynExpr.LetOrUseBang(isUse = true)) :: _ -> // use! x = // Note: Type is forbidden too... Parens.Forbidden - | SyntaxNode.SynExpr (SynExpr.LetOrUseBang(isUse = false)) :: _ -> + | SyntaxNode.SynExpr(SynExpr.LetOrUseBang(isUse = false)) :: _ -> // let! x = Parens.Required patternRange - | SyntaxNode.SynExpr (SynExpr.ForEach _) :: _ -> + | SyntaxNode.SynExpr(SynExpr.ForEach _) :: _ -> // for i in [1..4] do Parens.Optional patternRange | [] @@ -556,7 +556,7 @@ let rec private getParensForPatternWithIdent (patternRange: Range) (identStart: let private rangeOfNamedPat (text: NamedText) (pat: SynPat) = match pat with | SynPat.Named(accessibility = None) -> pat.Range - | SynPat.Named (ident = ident; accessibility = Some (access)) -> + | SynPat.Named(ident = ident; accessibility = Some(access)) -> maybe { let start = ident.idRange.Start let! line = text.GetLine start @@ -588,13 +588,13 @@ let private rangeOfNamedPat (text: NamedText) (pat: SynPat) = /// Note: (deliberately) fails when `pat` is neither `Named` nor `OptionalVal` let rec private getParensForIdentPat (text: NamedText) (pat: SynPat) (path: SyntaxVisitorPath) = match pat with - | SynPat.Named (ident = ident) -> + | SynPat.Named(ident = ident) -> // neither `range`, not `pat.Range` includes `accessibility`... // `let private (a: int)` is not valid, must include private: `let (private a: int)` let patternRange = rangeOfNamedPat text pat let identStart = ident.idRange.Start getParensForPatternWithIdent patternRange identStart path - | SynPat.OptionalVal (ident = ident) -> + | SynPat.OptionalVal(ident = ident) -> let patternRange = pat.Range let identStart = ident.idRange.Start getParensForPatternWithIdent patternRange identStart path @@ -612,8 +612,8 @@ let tryGetExplicitTypeInfo (text: NamedText, ast: ParsedInput) (pos: Position) : // for i = 1 to 3 do // ^ -> just Ident (neither SynPat nor SynSimplePat) // -> no type allowed (not even parens)... - | SynExpr.For (ident = ident) when rangeContainsPos ident.idRange pos -> ExplicitType.Invalid |> Some - | SynExpr.Lambda(parsedData = Some (args, body)) -> + | SynExpr.For(ident = ident) when rangeContainsPos ident.idRange pos -> ExplicitType.Invalid |> Some + | SynExpr.Lambda(parsedData = Some(args, body)) -> // original visitor walks down `SynExpr.Lambda(args; body)` // Issue: // `args` are `SynSimplePats` -> no complex pattern @@ -640,7 +640,7 @@ let tryGetExplicitTypeInfo (text: NamedText, ast: ParsedInput) (pos: Position) : member visitor.VisitPat(path, defaultTraverse, pat) = let invalidPositionForTypeAnnotation (pos: Position) (path: SyntaxNode list) = match path with - | SyntaxNode.SynExpr (SynExpr.LetOrUseBang(isUse = true)) :: _ -> + | SyntaxNode.SynExpr(SynExpr.LetOrUseBang(isUse = true)) :: _ -> // use! value = true | _ -> false @@ -658,11 +658,11 @@ let tryGetExplicitTypeInfo (text: NamedText, ast: ParsedInput) (pos: Position) : // no simple way out: Range for `SynPat.LongIdent` doesn't cover full pats (just ident) // see dotnet/fsharp#13115 // | _ when not (rangeContainsPos pat.Range pos) -> None - | SynPat.Named (ident = ident) when + | SynPat.Named(ident = ident) when rangeContainsPos ident.idRange pos && invalidPositionForTypeAnnotation pos path -> ExplicitType.Invalid |> Some - | SynPat.Named (ident = ident; isThisVal = false) when rangeContainsPos ident.idRange pos -> + | SynPat.Named(ident = ident; isThisVal = false) when rangeContainsPos ident.idRange pos -> let typed = isDirectlyTyped ident.idRange.Start path if typed then @@ -676,7 +676,7 @@ let tryGetExplicitTypeInfo (text: NamedText, ast: ParsedInput) (pos: Position) : Parens = parens SpecialRules = [] } |> Some - | SynPat.OptionalVal (ident = ident) when rangeContainsPos ident.idRange pos -> + | SynPat.OptionalVal(ident = ident) when rangeContainsPos ident.idRange pos -> let typed = isDirectlyTyped ident.idRange.Start path if typed then @@ -712,9 +712,9 @@ let tryGetExplicitTypeInfo (text: NamedText, ast: ParsedInput) (pos: Position) : let rec tryGetIdent pat = match pat with - | SynSimplePat.Id (ident = ident) when rangeContainsPos ident.idRange pos -> Some pat - | SynSimplePat.Attrib (pat = pat) when rangeContainsPos pat.Range pos -> tryGetIdent pat - | SynSimplePat.Typed (pat = pat) when rangeContainsPos pat.Range pos -> tryGetIdent pat + | SynSimplePat.Id(ident = ident) when rangeContainsPos ident.idRange pos -> Some pat + | SynSimplePat.Attrib(pat = pat) when rangeContainsPos pat.Range pos -> tryGetIdent pat + | SynSimplePat.Typed(pat = pat) when rangeContainsPos pat.Range pos -> tryGetIdent pat | _ -> None let! ident = tryGetIdent pat @@ -725,7 +725,7 @@ let tryGetExplicitTypeInfo (text: NamedText, ast: ParsedInput) (pos: Position) : function | SynSimplePat.Typed _ -> true | SynSimplePat.Id _ -> false - | SynSimplePat.Attrib (pat = pat) -> isTyped pat + | SynSimplePat.Attrib(pat = pat) -> isTyped pat let typed = isTyped pat @@ -737,9 +737,11 @@ let tryGetExplicitTypeInfo (text: NamedText, ast: ParsedInput) (pos: Position) : |> List.tryHead |> Option.map (function // normal ctor in type: `type A(v) = ...` - | SyntaxNode.SynMemberDefn (SynMemberDefn.ImplicitCtor _) -> true + | SyntaxNode.SynMemberDefn(SynMemberDefn.ImplicitCtor _) -> true //TODO: when? example? - | SyntaxNode.SynTypeDefn (SynTypeDefn(typeRepr = SynTypeDefnRepr.Simple(simpleRepr = SynTypeDefnSimpleRepr.General(implicitCtorSynPats = Some (ctorPats))))) when + | SyntaxNode.SynTypeDefn(SynTypeDefn( + typeRepr = SynTypeDefnRepr.Simple( + simpleRepr = SynTypeDefnSimpleRepr.General(implicitCtorSynPats = Some(ctorPats))))) when rangeContainsPos ctorPats.Range pos -> true @@ -786,10 +788,10 @@ let private getArgRangesOfFunctionApplication (ast: ParsedInput) pos = { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, traverseSynExpr, defaultTraverse, expr) = match expr with - | SynExpr.App (isInfix = false; funcExpr = funcExpr; argExpr = argExpr; range = range) when pos = range.Start -> + | SynExpr.App(isInfix = false; funcExpr = funcExpr; argExpr = argExpr; range = range) when pos = range.Start -> let isInfixFuncExpr = match funcExpr with - | SynExpr.App (_, isInfix, _, _, _) -> isInfix + | SynExpr.App(_, isInfix, _, _, _) -> isInfix | _ -> false if isInfixFuncExpr then @@ -797,7 +799,7 @@ let private getArgRangesOfFunctionApplication (ast: ParsedInput) pos = else let rec withoutParens = function - | SynExpr.Paren (expr = expr) -> withoutParens expr + | SynExpr.Paren(expr = expr) -> withoutParens expr | expr -> expr // f a (b,c) // ^^^^^^^^^ App @@ -809,8 +811,8 @@ let private getArgRangesOfFunctionApplication (ast: ParsedInput) pos = let rec findArgs expr = match expr with | SynExpr.Const(constant = SynConst.Unit) -> [] - | SynExpr.Paren (expr = expr) -> findArgs expr - | SynExpr.App (funcExpr = funcExpr; argExpr = argExpr) -> + | SynExpr.Paren(expr = expr) -> findArgs expr + | SynExpr.App(funcExpr = funcExpr; argExpr = argExpr) -> let otherArgRanges = findArgs funcExpr let argRange = @@ -818,7 +820,7 @@ let private getArgRangesOfFunctionApplication (ast: ParsedInput) pos = let tupleArgs = match argExpr |> withoutParens with - | SynExpr.Tuple (exprs = exprs) -> exprs |> List.map (fun e -> e.Range) + | SynExpr.Tuple(exprs = exprs) -> exprs |> List.map (fun e -> e.Range) | _ -> argRange |> List.singleton (argRange, tupleArgs) diff --git a/src/FsAutoComplete.Core/Lexer.fs b/src/FsAutoComplete.Core/Lexer.fs index 88f831ef9..f21ac3c21 100644 --- a/src/FsAutoComplete.Core/Lexer.fs +++ b/src/FsAutoComplete.Core/Lexer.fs @@ -109,77 +109,74 @@ module Lexer = let private fixTokens lineStr (tokens: FSharpTokenInfo list) = tokens |> List.fold - (fun (acc, (lastToken: DraftToken option)) token -> - match lastToken with - //Operator starting with . (like .>>) should be operator - | Some ({ Kind = SymbolKind.Dot } as lastToken) when - isOperator token && token.LeftColumn <= lastToken.RightColumn - -> - let mergedToken = - { lastToken.Token with - Tag = token.Tag - RightColumn = token.RightColumn } - - acc, - Some - { lastToken with - Token = mergedToken - Kind = SymbolKind.Operator } - | Some t when token.LeftColumn <= t.RightColumn -> acc, lastToken - | Some ({ Kind = SymbolKind.ActivePattern } as lastToken) when - token.Tag = FSharpTokenTag.BAR - || token.Tag = FSharpTokenTag.IDENT - || token.Tag = FSharpTokenTag.UNDERSCORE - -> - let mergedToken = - { lastToken.Token with - Tag = FSharpTokenTag.IDENT - RightColumn = token.RightColumn - FullMatchedLength = lastToken.Token.FullMatchedLength + token.FullMatchedLength } - - acc, - Some - { lastToken with - Token = mergedToken - RightColumn = lastToken.RightColumn + token.FullMatchedLength } - | _ -> - match token, lineStr with - | GenericTypeParameterPrefix -> acc, Some(DraftToken.Create GenericTypeParameter token) - | StaticallyResolvedTypeParameterPrefix -> - acc, Some(DraftToken.Create StaticallyResolvedTypeParameter token) - | ActivePattern -> acc, Some(DraftToken.Create ActivePattern token) - | Other -> - let draftToken = - match lastToken with - | Some { Kind = GenericTypeParameter | StaticallyResolvedTypeParameter as kind } when - isIdentifier token - -> - DraftToken.Create - kind - { token with - LeftColumn = token.LeftColumn - 1 - FullMatchedLength = token.FullMatchedLength + 1 } - | Some ({ Kind = SymbolKind.ActivePattern } as ap) when token.Tag = FSharpTokenTag.RPAREN -> - DraftToken.Create SymbolKind.Ident ap.Token - | Some ({ Kind = SymbolKind.Operator } as op) when token.Tag = FSharpTokenTag.RPAREN -> - DraftToken.Create SymbolKind.Operator op.Token - // ^ operator - | Some { Kind = SymbolKind.StaticallyResolvedTypeParameter } -> - { Kind = SymbolKind.Operator - RightColumn = token.RightColumn - 1 - Token = token } - | _ -> - let kind = - if isOperator token then Operator - elif isIdentifier token then Ident - elif isKeyword token then Keyword - elif isPunctuation token then Dot - else Other - - DraftToken.Create kind token - - draftToken :: acc, Some draftToken) - ([], None) + (fun (acc, (lastToken: DraftToken option)) token -> + match lastToken with + //Operator starting with . (like .>>) should be operator + | Some({ Kind = SymbolKind.Dot } as lastToken) when + isOperator token && token.LeftColumn <= lastToken.RightColumn + -> + let mergedToken = + { lastToken.Token with + Tag = token.Tag + RightColumn = token.RightColumn } + + acc, + Some + { lastToken with + Token = mergedToken + Kind = SymbolKind.Operator } + | Some t when token.LeftColumn <= t.RightColumn -> acc, lastToken + | Some({ Kind = SymbolKind.ActivePattern } as lastToken) when + token.Tag = FSharpTokenTag.BAR + || token.Tag = FSharpTokenTag.IDENT + || token.Tag = FSharpTokenTag.UNDERSCORE + -> + let mergedToken = + { lastToken.Token with + Tag = FSharpTokenTag.IDENT + RightColumn = token.RightColumn + FullMatchedLength = lastToken.Token.FullMatchedLength + token.FullMatchedLength } + + acc, + Some + { lastToken with + Token = mergedToken + RightColumn = lastToken.RightColumn + token.FullMatchedLength } + | _ -> + match token, lineStr with + | GenericTypeParameterPrefix -> acc, Some(DraftToken.Create GenericTypeParameter token) + | StaticallyResolvedTypeParameterPrefix -> acc, Some(DraftToken.Create StaticallyResolvedTypeParameter token) + | ActivePattern -> acc, Some(DraftToken.Create ActivePattern token) + | Other -> + let draftToken = + match lastToken with + | Some { Kind = GenericTypeParameter | StaticallyResolvedTypeParameter as kind } when isIdentifier token -> + DraftToken.Create + kind + { token with + LeftColumn = token.LeftColumn - 1 + FullMatchedLength = token.FullMatchedLength + 1 } + | Some({ Kind = SymbolKind.ActivePattern } as ap) when token.Tag = FSharpTokenTag.RPAREN -> + DraftToken.Create SymbolKind.Ident ap.Token + | Some({ Kind = SymbolKind.Operator } as op) when token.Tag = FSharpTokenTag.RPAREN -> + DraftToken.Create SymbolKind.Operator op.Token + // ^ operator + | Some { Kind = SymbolKind.StaticallyResolvedTypeParameter } -> + { Kind = SymbolKind.Operator + RightColumn = token.RightColumn - 1 + Token = token } + | _ -> + let kind = + if isOperator token then Operator + elif isIdentifier token then Ident + elif isKeyword token then Keyword + elif isPunctuation token then Dot + else Other + + DraftToken.Create kind token + + draftToken :: acc, Some draftToken) + ([], None) |> fst // Returns symbol at a given position. diff --git a/src/FsAutoComplete.Core/ParseAndCheckResults.fs b/src/FsAutoComplete.Core/ParseAndCheckResults.fs index fbf6d1a0d..7fc60c584 100644 --- a/src/FsAutoComplete.Core/ParseAndCheckResults.fs +++ b/src/FsAutoComplete.Core/ParseAndCheckResults.fs @@ -23,11 +23,7 @@ type FindDeclarationResult = | File of string type ParseAndCheckResults - ( - parseResults: FSharpParseFileResults, - checkResults: FSharpCheckFileResults, - entityCache: EntityCache - ) = + (parseResults: FSharpParseFileResults, checkResults: FSharpCheckFileResults, entityCache: EntityCache) = let logger = LogProvider.getLoggerByName "ParseAndCheckResults" @@ -77,7 +73,7 @@ type ParseAndCheckResults member x.TryFindIdentifierDeclaration (pos: Position) (lineStr: LineStr) = match Lexer.findLongIdents (pos.Column, lineStr) with | None -> async.Return(ResultOrString.Error "Could not find ident at this location") - | Some (col, identIsland) -> + | Some(col, identIsland) -> let identIsland = Array.toList identIsland let declarations = @@ -86,11 +82,11 @@ type ParseAndCheckResults let decompile assembly externalSym = match Decompiler.tryFindExternalDeclaration checkResults (assembly, externalSym) with | Ok extDec -> ResultOrString.Ok(FindDeclarationResult.ExternalDeclaration extDec) - | Error (Decompiler.FindExternalDeclarationError.ReferenceHasNoFileName assy) -> + | Error(Decompiler.FindExternalDeclarationError.ReferenceHasNoFileName assy) -> ResultOrString.Error(sprintf "External declaration assembly '%s' missing file name" assy.SimpleName) - | Error (Decompiler.FindExternalDeclarationError.ReferenceNotFound assy) -> + | Error(Decompiler.FindExternalDeclarationError.ReferenceNotFound assy) -> ResultOrString.Error(sprintf "External declaration assembly '%s' not found" assy) - | Error (Decompiler.FindExternalDeclarationError.DecompileError (Decompiler.Exception (symbol, file, exn))) -> + | Error(Decompiler.FindExternalDeclarationError.DecompileError(Decompiler.Exception(symbol, file, exn))) -> Error( sprintf "Error while decompiling symbol '%A' in file '%s': %s\n%s" symbol file exn.Message exn.StackTrace ) @@ -101,11 +97,11 @@ type ParseAndCheckResults : (string * Position) option = match sym with | FindDeclExternalSymbol.Type name -> None - | FindDeclExternalSymbol.Constructor (typeName, args) -> None - | FindDeclExternalSymbol.Method (typeName, name, paramSyms, genericArity) -> None - | FindDeclExternalSymbol.Field (typeName, name) -> None - | FindDeclExternalSymbol.Event (typeName, name) -> None - | FindDeclExternalSymbol.Property (typeName, name) -> None + | FindDeclExternalSymbol.Constructor(typeName, args) -> None + | FindDeclExternalSymbol.Method(typeName, name, paramSyms, genericArity) -> None + | FindDeclExternalSymbol.Field(typeName, name) -> None + | FindDeclExternalSymbol.Event(typeName, name) -> None + | FindDeclExternalSymbol.Property(typeName, name) -> None // attempts to manually discover symbol use and externalsymbol information for a range that doesn't exist in a local file // bugfix/workaround for FCS returning invalid declfound for f# members. @@ -117,7 +113,7 @@ type ParseAndCheckResults ResultOrString.Error( sprintf "Range for nonexistent file found, no ident found: %s" rangeInNonexistentFile.FileName ) - | Some (col, identIsland) -> + | Some(col, identIsland) -> let identIsland = Array.toList identIsland let symbolUse = @@ -181,7 +177,7 @@ type ParseAndCheckResults ) match tryRecoverExternalSymbolForNonexistentDecl rangeInNonexistentFile with - | Ok (assemblyFile, sourceFile) -> + | Ok(assemblyFile, sourceFile) -> match! Sourcelink.tryFetchSourcelinkFile assemblyFile sourceFile with | Ok localFilePath -> return @@ -192,10 +188,10 @@ type ParseAndCheckResults ) | Error reason -> return ResultOrString.Error(sprintf "%A" reason) | Error e -> return Error e - | FindDeclResult.ExternalDecl (assembly, externalSym) -> + | FindDeclResult.ExternalDecl(assembly, externalSym) -> // not enough info on external symbols to get a range-like thing :( match tryGetSourceRangeForSymbol externalSym with - | Some (sourceFile, pos) -> + | Some(sourceFile, pos) -> match! Sourcelink.tryFetchSourcelinkFile (UMX.tag assembly) sourceFile with | Ok localFilePath -> return @@ -218,7 +214,7 @@ type ParseAndCheckResults async { match Lexer.findLongIdents (pos.Column, lineStr) with | None -> return Error "Cannot find ident at this location" - | Some (col, identIsland) -> + | Some(col, identIsland) -> let identIsland = Array.toList identIsland let symbol = @@ -235,8 +231,8 @@ type ParseAndCheckResults let rec tryGetSource (ty: FSharpEntity option) = async { match ty |> Option.map (fun ty -> ty, ty.DeclarationLocation) with - | Some (_, loc) when File.Exists loc.FileName -> return Ok(FindDeclarationResult.Range loc) - | Some (ty, loc) -> + | Some(_, loc) when File.Exists loc.FileName -> return Ok(FindDeclarationResult.Range loc) + | Some(ty, loc) -> match ty.Assembly.FileName with | Some dllFile -> let dllFile = UMX.tag dllFile @@ -265,13 +261,11 @@ type ParseAndCheckResults let decompile assembly externalSym = match Decompiler.tryFindExternalDeclaration checkResults (assembly, externalSym) with | Ok extDec -> ResultOrString.Ok(FindDeclarationResult.ExternalDeclaration extDec) - | Error (Decompiler.FindExternalDeclarationError.ReferenceHasNoFileName assy) -> + | Error(Decompiler.FindExternalDeclarationError.ReferenceHasNoFileName assy) -> ResultOrString.Error(sprintf "External declaration assembly '%s' missing file name" assy.SimpleName) - | Error (Decompiler.FindExternalDeclarationError.ReferenceNotFound assy) -> + | Error(Decompiler.FindExternalDeclarationError.ReferenceNotFound assy) -> ResultOrString.Error(sprintf "External declaration assembly '%s' not found" assy) - | Error (Decompiler.FindExternalDeclarationError.DecompileError (Decompiler.Exception (symbol, - file, - exn))) -> + | Error(Decompiler.FindExternalDeclarationError.DecompileError(Decompiler.Exception(symbol, file, exn))) -> Error( sprintf "Error while decompiling symbol '%A' in file '%s': %s\n%s" @@ -299,7 +293,7 @@ type ParseAndCheckResults | SymbolUse.Constructor c -> c.DeclaringEntity | SymbolUse.Property p when p.IsPropertyGetterMethod -> Some p.ReturnParameter.Type |> tryGetTypeDef | SymbolUse.Val v -> v.FullTypeSafe |> tryGetTypeDef - | SymbolUse.Entity (e, _) -> Some e + | SymbolUse.Entity(e, _) -> Some e | SymbolUse.UnionCase c -> Some c.ReturnType |> tryGetTypeDef | SymbolUse.Parameter p -> Some p.Type |> tryGetTypeDef | _ -> None @@ -310,14 +304,14 @@ type ParseAndCheckResults member __.TryGetToolTip (pos: Position) (lineStr: LineStr) = match Lexer.findLongIdents (pos.Column, lineStr) with | None -> ResultOrString.Error "Cannot find ident for tooltip" - | Some (col, identIsland) -> + | Some(col, identIsland) -> let identIsland = Array.toList identIsland // TODO: Display other tooltip types, for example for strings or comments where appropriate let tip = checkResults.GetToolTip(pos.Line, col, lineStr, identIsland, FSharpTokenTag.Identifier) match tip with - | ToolTipText (elems) when elems |> List.forall ((=) ToolTipElement.None) -> + | ToolTipText(elems) when elems |> List.forall ((=) ToolTipElement.None) -> match identIsland with | [ ident ] -> match KeywordList.keywordTooltips.TryGetValue ident with @@ -339,7 +333,7 @@ type ParseAndCheckResults | Completion.Context.Unknown -> match Lexer.findLongIdents (pos.Column, lineStr) with | None -> Error "Cannot find ident for tooltip" - | Some (col, identIsland) -> + | Some(col, identIsland) -> let identIsland = Array.toList identIsland // TODO: Display other tooltip types, for example for strings or comments where appropriate let tip = @@ -363,7 +357,7 @@ type ParseAndCheckResults match SignatureFormatter.getTooltipDetailsFromSymbolUse symbol with | None -> Error "No tooltip information" - | Some (signature, footer) -> + | Some(signature, footer) -> let typeDoc = getTypeIfConstructor symbol.Symbol |> Option.map (fun n -> n.XmlDocSig) @@ -372,7 +366,7 @@ type ParseAndCheckResults member __.TryGetFormattedDocumentation (pos: Position) (lineStr: LineStr) = match Lexer.findLongIdents (pos.Column, lineStr) with | None -> Error "Cannot find ident" - | Some (col, identIsland) -> + | Some(col, identIsland) -> let identIsland = Array.toList identIsland // TODO: Display other tooltip types, for example for strings or comments where appropriate let tip = @@ -382,7 +376,7 @@ type ParseAndCheckResults checkResults.GetSymbolUseAtLocation(pos.Line, col, lineStr, identIsland) match tip with - | ToolTipText (elems) when elems |> List.forall ((=) ToolTipElement.None) && symbol.IsNone -> + | ToolTipText(elems) when elems |> List.forall ((=) ToolTipElement.None) && symbol.IsNone -> match identIsland with | [ ident ] -> match KeywordList.keywordTooltips.TryGetValue ident with @@ -395,7 +389,7 @@ type ParseAndCheckResults | Some symbol -> match DocumentationFormatter.getTooltipDetailsFromSymbolUse symbol with | None -> Error "No documentation information" - | Some (signature, footer, cn) -> + | Some(signature, footer, cn) -> match symbol with | SymbolUse.TypeAbbreviation symbol -> Ok( @@ -420,7 +414,7 @@ type ParseAndCheckResults if not check then match e.Symbol with - | FSharpEntity (_, abrvEnt, _) -> abrvEnt.XmlDocSig = xmlSig && abrvEnt.Assembly.SimpleName = assembly + | FSharpEntity(_, abrvEnt, _) -> abrvEnt.XmlDocSig = xmlSig && abrvEnt.Assembly.SimpleName = assembly | _ -> false else true) @@ -435,7 +429,7 @@ type ParseAndCheckResults if not check then match e.Symbol with - | FSharpEntity (_, abrvEnt, _) -> abrvEnt.XmlDocSig = xmlSig + | FSharpEntity(_, abrvEnt, _) -> abrvEnt.XmlDocSig = xmlSig | _ -> false else true) @@ -447,7 +441,7 @@ type ParseAndCheckResults entities |> List.tryPick (fun e -> match e.Symbol with - | FSharpEntity (ent, _, _) -> + | FSharpEntity(ent, _, _) -> match ent.MembersFunctionsAndValues |> Seq.tryFind (fun f -> f.XmlDocSig = xmlSig) with | Some e -> Some(e :> FSharpSymbol) | None -> @@ -461,13 +455,13 @@ type ParseAndCheckResults | Some symbol -> match DocumentationFormatter.getTooltipDetailsFromSymbol symbol with | None -> Error "No tooltip information" - | Some (signature, footer, cn) -> + | Some(signature, footer, cn) -> Ok(symbol.XmlDocSig, symbol.Assembly.FileName |> Option.defaultValue "", symbol.XmlDoc, signature, footer, cn) member __.TryGetSymbolUse (pos: Position) (lineStr: LineStr) : FSharpSymbolUse option = match Lexer.findLongIdents (pos.Column, lineStr) with | None -> None - | Some (colu, identIsland) -> + | Some(colu, identIsland) -> let identIsland = Array.toList identIsland checkResults.GetSymbolUseAtLocation(pos.Line, colu, lineStr, identIsland) @@ -483,7 +477,7 @@ type ParseAndCheckResults member __.TryGetSignatureData (pos: Position) (lineStr: LineStr) = match Lexer.findLongIdents (pos.Column, lineStr) with | None -> ResultOrString.Error "No ident at this location" - | Some (colu, identIsland) -> + | Some(colu, identIsland) -> let identIsland = Array.toList identIsland @@ -527,7 +521,7 @@ type ParseAndCheckResults member __.TryGetF1Help (pos: Position) (lineStr: LineStr) = match Lexer.findLongIdents (pos.Column, lineStr) with | None -> ResultOrString.Error "No ident at this location" - | Some (colu, identIsland) -> + | Some(colu, identIsland) -> let identIsland = Array.toList identIsland let help = checkResults.GetF1Keyword(pos.Line, colu, lineStr, identIsland) diff --git a/src/FsAutoComplete.Core/RecordStubGenerator.fs b/src/FsAutoComplete.Core/RecordStubGenerator.fs index 9ad3dcf66..60ec6e811 100644 --- a/src/FsAutoComplete.Core/RecordStubGenerator.fs +++ b/src/FsAutoComplete.Core/RecordStubGenerator.fs @@ -49,7 +49,7 @@ type RecordStubsInsertionParams = IndentColumn = pos.Column + 1 InsertionPos = pos } |> Some - | Some (_toCopy, (withSeparator, _)) -> + | Some(_toCopy, (withSeparator, _)) -> { Kind = PositionKind.AfterCopyExpression IndentColumn = withSeparator.End.Column + 1 InsertionPos = withSeparator.End } @@ -65,7 +65,7 @@ type RecordStubsInsertionParams = expr.FieldExprList |> List.choose (fun fieldInfo -> match fieldInfo with - | SynExprRecordField (fieldName = (LongIdentWithDots (identHead :: _, _), true)) -> + | SynExprRecordField(fieldName = (LongIdentWithDots(identHead :: _, _), true)) -> let fieldLine = identHead.idRange.StartLine let indentColumn = identHead.idRange.StartColumn Some(fieldInfo, indentColumn, fieldLine) @@ -89,16 +89,15 @@ type RecordStubsInsertionParams = return! match lastFieldInfo with | SynExprRecordField(expr = None) -> None - | SynExprRecordField (fieldName = (LongIdentWithDots (_ :: _, _), true) - expr = Some expr - blockSeparator = semiColonOpt) -> + | SynExprRecordField( + fieldName = (LongIdentWithDots(_ :: _, _), true); expr = Some expr; blockSeparator = semiColonOpt) -> match semiColonOpt with | None -> { Kind = PositionKind.AfterLastField IndentColumn = indentColumn InsertionPos = expr.Range.End } |> Some - | Some (_range, Some semiColonEndPos) -> + | Some(_range, Some semiColonEndPos) -> { Kind = PositionKind.AfterLastField IndentColumn = indentColumn InsertionPos = semiColonEndPos } @@ -152,7 +151,7 @@ let formatRecord let fieldsWritten = fieldsWritten |> List.collect (function - | SynExprRecordField (fieldName = (fieldName, _)) -> + | SynExprRecordField(fieldName = (fieldName, _)) -> // Extract in qualified identifiers: A.B. = ... if fieldName.Lid.Length > 0 then [ (fieldName.Lid.Item(fieldName.Lid.Length - 1)).idText ] @@ -199,7 +198,7 @@ let walkAndFindRecordBinding (pos, input) = synExpr: SynExpr ) = match synExpr with - | SynExpr.Record (recordFields = recordFields; copyInfo = copyInfo) -> + | SynExpr.Record(recordFields = recordFields; copyInfo = copyInfo) -> Some { Expr = synExpr CopyExprOption = copyInfo @@ -208,7 +207,7 @@ let walkAndFindRecordBinding (pos, input) = recordFields |> List.tryLast |> Option.map (function - | SynExprRecordField (fieldName = (id, _)) -> id.Range.Start) + | SynExprRecordField(fieldName = (id, _)) -> id.Range.Start) |> Option.defaultValue synExpr.Range.Start } | _ -> defaultTraverse synExpr } @@ -232,7 +231,7 @@ let checkThatRecordExprEndsWithRBrace (codeGenService: ICodeGenerationService) ( let lastField = Seq.last expr.FieldExprList match lastField with - | SynExprRecordField(blockSeparator = Some (semiColonRange, Some _semiColonEndPos)) -> + | SynExprRecordField(blockSeparator = Some(semiColonRange, Some _semiColonEndPos)) -> // The last field ends with a ';' // Look here: { field = expr; ... } Some(Range.unionRanges semiColonRange.EndRange expr.Expr.Range.EndRange) diff --git a/src/FsAutoComplete.Core/SignatureFormatter.fs b/src/FsAutoComplete.Core/SignatureFormatter.fs index fac2d908b..d5b9f9f8e 100644 --- a/src/FsAutoComplete.Core/SignatureFormatter.fs +++ b/src/FsAutoComplete.Core/SignatureFormatter.fs @@ -98,7 +98,7 @@ module SignatureFormatter = let memberConstraint (c: FSharpGenericParameterMemberConstraint) = let formattedMemberName, isProperty = match c.IsProperty, PrettyNaming.TryChopPropertyName c.MemberName with - | true, Some (chopped) when chopped <> c.MemberName -> chopped, true + | true, Some(chopped) when chopped <> c.MemberName -> chopped, true | _, _ -> if PrettyNaming.IsMangledOpName c.MemberName then $"( {PrettyNaming.DecompileOpName c.MemberName} )", false @@ -615,11 +615,11 @@ module SignatureFormatter = fse.MembersFunctionsAndValues |> Seq.filter (fun n -> n.IsConstructor && n.Accessibility.IsPublic) |> fun v -> - match Seq.tryHead v with - | None -> "" - | Some f -> - let l = Seq.length v - getFuncSignatureForTypeSignature displayContext f l false false + match Seq.tryHead v with + | None -> "" + | Some f -> + let l = Seq.length v + getFuncSignatureForTypeSignature displayContext f l false false let fields = fse.FSharpFields @@ -722,7 +722,7 @@ module SignatureFormatter = match entity with | SymbolUse.MemberFunctionOrValue m -> Some(m.FullName, m.Assembly.SimpleName) - | SymbolUse.Entity (c, _) -> Some(c.FullName, c.Assembly.SimpleName) + | SymbolUse.Entity(c, _) -> Some(c.FullName, c.Assembly.SimpleName) | SymbolUse.Field f -> Some(f.FullName, f.Assembly.SimpleName) @@ -738,7 +738,7 @@ module SignatureFormatter = ///Returns formated symbol signature and footer that can be used to enhance standard FCS' text tooltips let getTooltipDetailsFromSymbolUse (symbol: FSharpSymbolUse) = match symbol with - | SymbolUse.Entity (fse, _) -> + | SymbolUse.Entity(fse, _) -> try let signature = getEntitySignature symbol.DisplayContext fse Some(signature, footerForType symbol) diff --git a/src/FsAutoComplete.Core/SignatureHelp.fs b/src/FsAutoComplete.Core/SignatureHelp.fs index f5d6d9c16..b42a56ca2 100644 --- a/src/FsAutoComplete.Core/SignatureHelp.fs +++ b/src/FsAutoComplete.Core/SignatureHelp.fs @@ -176,8 +176,7 @@ let private getSignatureHelpForMethod (tyRes: ParseAndCheckResults, caretPos: Po // should not result in a prompt, whereas this one will: // Console.WriteLine( [(1,2)], match triggerChar with - | Some ('<' | '(' | ',') when not (tupleEnds |> Array.exists (fun lp -> lp.Column = caretPos.Column)) -> - return! None // comma or paren at wrong location = remove help display + | Some('<' | '(' | ',') when not (tupleEnds |> Array.exists (fun lp -> lp.Column = caretPos.Column)) -> return! None // comma or paren at wrong location = remove help display | _ -> // Compute the argument index by working out where the caret is between the various commas. let argumentIndex = @@ -216,13 +215,13 @@ let getSignatureHelpFor let rec loop ch pos = if Char.IsWhiteSpace ch then match lines.TryGetPrevChar pos with - | Some (prevPos, prevChar) -> loop prevChar prevPos + | Some(prevPos, prevChar) -> loop prevChar prevPos | None -> None else Some(pos, ch) match lines.TryGetPrevChar pos with - | Some (prevPos, prevChar) -> loop prevChar prevPos + | Some(prevPos, prevChar) -> loop prevChar prevPos | None -> None let! (previousNonWhitespaceCharPos, previousNonWhitespaceChar) = diff --git a/src/FsAutoComplete.Core/Sourcelink.fs b/src/FsAutoComplete.Core/Sourcelink.fs index caa9e7cdd..f5b1f0aae 100644 --- a/src/FsAutoComplete.Core/Sourcelink.fs +++ b/src/FsAutoComplete.Core/Sourcelink.fs @@ -215,7 +215,7 @@ let private tryGetUrlForDocument (json: SourceLinkJson) (document: Document) = | null -> None | documents -> documents - |> Seq.tryPick (fun (KeyValue (path, url)) -> + |> Seq.tryPick (fun (KeyValue(path, url)) -> if isWildcardPattern path then tryGetUrlWithWildcard path url document else @@ -286,7 +286,7 @@ let tryFetchSourcelinkFile (dllPath: string) (targetFile: string match tryGetUrlForDocument json doc with - | Some (url, fragment, document) -> + | Some(url, fragment, document) -> let! tempFile = downloadFileToTempDir url fragment document return Ok tempFile | None -> @@ -295,10 +295,10 @@ let tryFetchSourcelinkFile (dllPath: string) (targetFile: string> Log.addContext "target" doc.Name >> Log.addContext - "patterns" - (json.documents - |> Seq.map (function - | (KeyValue (k, _)) -> k)) + "patterns" + (json.documents + |> Seq.map (function + | (KeyValue(k, _)) -> k)) ) return Error MissingPatterns diff --git a/src/FsAutoComplete.Core/State.fs b/src/FsAutoComplete.Core/State.fs index 0acb9670f..4209f4f95 100644 --- a/src/FsAutoComplete.Core/State.fs +++ b/src/FsAutoComplete.Core/State.fs @@ -262,7 +262,7 @@ type State = : ResultOrString = match x.Files.TryFind(file) with | None -> ResultOrString.Error(sprintf "File '%s' not parsed" (UMX.untag file)) - | Some (volFile) -> + | Some(volFile) -> match x.ProjectController.GetProjectOptions((UMX.untag file)) with | None -> Ok(State.FileWithoutProjectOptions(file), volFile.Lines) @@ -273,7 +273,7 @@ type State = : ResultOrString = match x.TryGetFileCheckerOptionsWithLines(file) with | ResultOrString.Error x -> ResultOrString.Error x - | Ok (opts, lines) -> Ok(opts, lines) + | Ok(opts, lines) -> Ok(opts, lines) member x.TryGetFileSource(file: string) : ResultOrString = match x.Files.TryFind(file) with diff --git a/src/FsAutoComplete.Core/TestAdapter.fs b/src/FsAutoComplete.Core/TestAdapter.fs index 8fe8a0e80..e3ba60f30 100644 --- a/src/FsAutoComplete.Core/TestAdapter.fs +++ b/src/FsAutoComplete.Core/TestAdapter.fs @@ -23,8 +23,8 @@ let private XUnitType = "XUnit" let rec private (|Sequentials|_|) = function - | SynExpr.Sequential (_, _, e, Sequentials es, _) -> Some(e :: es) - | SynExpr.Sequential (_, _, e1, e2, _) -> Some [ e1; e2 ] + | SynExpr.Sequential(_, _, e, Sequentials es, _) -> Some(e :: es) + | SynExpr.Sequential(_, _, e1, e2, _) -> Some [ e1; e2 ] | _ -> None let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = @@ -64,7 +64,7 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = if isExpectoName i.idText then Case elif isExpectoListName i.idText then List else NotExpecto - | SynExpr.LongIdent (_, LongIdentWithDots (lst, _), _, _) -> + | SynExpr.LongIdent(_, LongIdentWithDots(lst, _), _, _) -> let i = lst |> List.last if isExpectoName i.idText then Case @@ -74,7 +74,7 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = let rec visitExpr (parent: TestAdapterEntry) = function - | SynExpr.App (_, _, SynExpr.App (_, _, expr1, SynExpr.Const (SynConst.String (text = s), _), range), expr2, _) -> + | SynExpr.App(_, _, SynExpr.App(_, _, expr1, SynExpr.Const(SynConst.String(text = s), _), range), expr2, _) -> match expr1, expr2 with | List, SynExpr.ArrayOrList _ | List, SynExpr.ArrayOrListComputed _ -> @@ -94,7 +94,7 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = visitExpr entry expr2 | Case, SynExpr.ComputationExpr _ | Case, SynExpr.Lambda _ - | Case, SynExpr.Paren (SynExpr.Lambda _, _, _, _) -> + | Case, SynExpr.Paren(SynExpr.Lambda _, _, _, _) -> ident <- ident + 1 let entry = @@ -109,18 +109,18 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = | _ -> visitExpr parent expr1 visitExpr parent expr2 - | SynExpr.App (_, _, SynExpr.App (_, _, expr1, _, _range), SynExpr.Const (SynConst.String (text = s), _), _) - | SynExpr.App (_, - _, - SynExpr.App (_, _, SynExpr.App (_, _, expr1, _, _range), _, _), - SynExpr.Const (SynConst.String (text = s), _), - _) - | SynExpr.App (_, - _, - SynExpr.App (_, _, SynExpr.App (_, _, SynExpr.App (_, _, expr1, _, _range), _, _), _, _), - SynExpr.Const (SynConst.String (text = s), _), - _) - | SynExpr.App (_, _, expr1, SynExpr.Const (SynConst.String (text = s), _), _range) -> //Take those applications that are using string constant as an argument + | SynExpr.App(_, _, SynExpr.App(_, _, expr1, _, _range), SynExpr.Const(SynConst.String(text = s), _), _) + | SynExpr.App(_, + _, + SynExpr.App(_, _, SynExpr.App(_, _, expr1, _, _range), _, _), + SynExpr.Const(SynConst.String(text = s), _), + _) + | SynExpr.App(_, + _, + SynExpr.App(_, _, SynExpr.App(_, _, SynExpr.App(_, _, expr1, _, _range), _, _), _, _), + SynExpr.Const(SynConst.String(text = s), _), + _) + | SynExpr.App(_, _, expr1, SynExpr.Const(SynConst.String(text = s), _), _range) -> //Take those applications that are using string constant as an argument match expr1 with | Case -> ident <- ident + 1 @@ -136,71 +136,71 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = parent.Childs.Add entry | List -> () | NotExpecto -> () - | SynExpr.ArrayOrListComputed (_, expr, _) - | SynExpr.ComputationExpr (expr = expr) - | SynExpr.Lambda (body = expr) - | SynExpr.YieldOrReturn (_, expr, _) - | SynExpr.YieldOrReturnFrom (_, expr, _) - | SynExpr.New (_, _, expr, _) - | SynExpr.Assert (expr, _) - | SynExpr.Do (expr, _) - | SynExpr.Typed (expr, _, _) - | SynExpr.Paren (expr, _, _, _) - | SynExpr.DoBang (expr, _) - | SynExpr.Downcast (expr, _, _) - | SynExpr.For (doBody = expr) - | SynExpr.Lazy (expr, _) - | SynExpr.TypeTest (expr, _, _) - | SynExpr.Upcast (expr, _, _) - | SynExpr.InferredUpcast (expr, _) - | SynExpr.InferredDowncast (expr, _) - | SynExpr.LongIdentSet (_, expr, _) - | SynExpr.DotGet (expr, _, _, _) - | SynExpr.ForEach (bodyExpr = expr) -> visitExpr parent expr - | SynExpr.App (_, _, expr1, expr2, _) - | SynExpr.TryFinally (tryExpr = expr1; finallyExpr = expr2) - | SynExpr.NamedIndexedPropertySet (_, expr1, expr2, _) - | SynExpr.DotNamedIndexedPropertySet (_, _, expr1, expr2, _) - | SynExpr.LetOrUseBang (rhs = expr1; body = expr2) - | SynExpr.While (_, expr1, expr2, _) -> + | SynExpr.ArrayOrListComputed(_, expr, _) + | SynExpr.ComputationExpr(expr = expr) + | SynExpr.Lambda(body = expr) + | SynExpr.YieldOrReturn(_, expr, _) + | SynExpr.YieldOrReturnFrom(_, expr, _) + | SynExpr.New(_, _, expr, _) + | SynExpr.Assert(expr, _) + | SynExpr.Do(expr, _) + | SynExpr.Typed(expr, _, _) + | SynExpr.Paren(expr, _, _, _) + | SynExpr.DoBang(expr, _) + | SynExpr.Downcast(expr, _, _) + | SynExpr.For(doBody = expr) + | SynExpr.Lazy(expr, _) + | SynExpr.TypeTest(expr, _, _) + | SynExpr.Upcast(expr, _, _) + | SynExpr.InferredUpcast(expr, _) + | SynExpr.InferredDowncast(expr, _) + | SynExpr.LongIdentSet(_, expr, _) + | SynExpr.DotGet(expr, _, _, _) + | SynExpr.ForEach(bodyExpr = expr) -> visitExpr parent expr + | SynExpr.App(_, _, expr1, expr2, _) + | SynExpr.TryFinally(tryExpr = expr1; finallyExpr = expr2) + | SynExpr.NamedIndexedPropertySet(_, expr1, expr2, _) + | SynExpr.DotNamedIndexedPropertySet(_, _, expr1, expr2, _) + | SynExpr.LetOrUseBang(rhs = expr1; body = expr2) + | SynExpr.While(_, expr1, expr2, _) -> visitExpr parent expr1 visitExpr parent expr2 | Sequentials exprs - | SynExpr.Tuple (_, exprs, _, _) - | SynExpr.ArrayOrList (_, exprs, _) -> List.iter (visitExpr parent) exprs - | SynExpr.Match (expr = expr; clauses = clauses) - | SynExpr.TryWith (tryExpr = expr; withCases = clauses) -> + | SynExpr.Tuple(_, exprs, _, _) + | SynExpr.ArrayOrList(_, exprs, _) -> List.iter (visitExpr parent) exprs + | SynExpr.Match(expr = expr; clauses = clauses) + | SynExpr.TryWith(tryExpr = expr; withCases = clauses) -> visitExpr parent expr visitMatches parent clauses - | SynExpr.IfThenElse (ifExpr = cond; thenExpr = trueBranch; elseExpr = falseBranchOpt) -> + | SynExpr.IfThenElse(ifExpr = cond; thenExpr = trueBranch; elseExpr = falseBranchOpt) -> visitExpr parent cond visitExpr parent trueBranch falseBranchOpt |> Option.iter (visitExpr parent) - | SynExpr.LetOrUse (bindings = bindings; body = body) -> + | SynExpr.LetOrUse(bindings = bindings; body = body) -> visitBindindgs parent bindings visitExpr parent body - | SynExpr.Record (_, _, fields, _) -> + | SynExpr.Record(_, _, fields, _) -> fields - |> List.choose (fun (SynExprRecordField (expr = expr)) -> expr) + |> List.choose (fun (SynExprRecordField(expr = expr)) -> expr) |> List.iter (visitExpr parent) - | SynExpr.MatchLambda (_, _, clauses, _, _) -> visitMatches parent clauses - | SynExpr.ObjExpr (bindings = bindings) -> visitBindindgs parent bindings + | SynExpr.MatchLambda(_, _, clauses, _, _) -> visitMatches parent clauses + | SynExpr.ObjExpr(bindings = bindings) -> visitBindindgs parent bindings | _ -> () - and visitBinding prefix (SynBinding (expr = body)) = visitExpr prefix body + and visitBinding prefix (SynBinding(expr = body)) = visitExpr prefix body and visitBindindgs prefix s = s |> List.iter (visitBinding prefix) - and visitMatch prefix (SynMatchClause (resultExpr = expr)) = visitExpr prefix expr + and visitMatch prefix (SynMatchClause(resultExpr = expr)) = visitExpr prefix expr and visitMatches prefix s = s |> List.iter (visitMatch prefix) let rec visitDeclarations prefix decls = for declaration in decls do match declaration with - | SynModuleDecl.Let (_, bindings, _) -> visitBindindgs prefix bindings - | SynModuleDecl.NestedModule (decls = decls) -> visitDeclarations prefix decls + | SynModuleDecl.Let(_, bindings, _) -> visitBindindgs prefix bindings + | SynModuleDecl.NestedModule(decls = decls) -> visitDeclarations prefix decls | _ -> () let visitModulesAndNamespaces prefix modulesOrNss = - Seq.iter (fun (SynModuleOrNamespace (_, _, _, decls, _, _, _, _)) -> visitDeclarations prefix decls) modulesOrNss + Seq.iter (fun (SynModuleOrNamespace(_, _, _, decls, _, _, _, _)) -> visitDeclarations prefix decls) modulesOrNss let allTests = { Name = "" @@ -211,7 +211,7 @@ let getExpectoTests (ast: ParsedInput) : TestAdapterEntry list = Type = "" } match ast with - | ParsedInput.ImplFile (ParsedImplFileInput (modules = modules)) -> visitModulesAndNamespaces allTests modules + | ParsedInput.ImplFile(ParsedImplFileInput(modules = modules)) -> visitModulesAndNamespaces allTests modules | _ -> () List.ofSeq allTests.Childs @@ -239,22 +239,22 @@ let getNUnitTest (ast: ParsedInput) : TestAdapterEntry list = let getName = function - | SynPat.Named (ident = name) -> name.idText - | SynPat.LongIdent(longDotId = LongIdentWithDots (ident, _)) -> ident |> List.last |> (fun n -> n.idText) + | SynPat.Named(ident = name) -> name.idText + | SynPat.LongIdent(longDotId = LongIdentWithDots(ident, _)) -> ident |> List.last |> (fun n -> n.idText) | _ -> "" let rec visitMember (parent: TestAdapterEntry) = function - | SynMemberDefn.Member (b, _) -> visitBinding parent b - | SynMemberDefn.LetBindings (bindings, _, _, _) -> + | SynMemberDefn.Member(b, _) -> visitBinding parent b + | SynMemberDefn.LetBindings(bindings, _, _, _) -> for b in bindings do visitBinding parent b - | SynMemberDefn.NestedType (typeDef, _, _) -> visitTypeDef parent typeDef + | SynMemberDefn.NestedType(typeDef, _, _) -> visitTypeDef parent typeDef | _ -> () and visitTypeDef parent t = - let (SynTypeDefn (typeInfo = ci; typeRepr = om; members = members)) = t - let (SynComponentInfo (longId = ids; range = r)) = ci + let (SynTypeDefn(typeInfo = ci; typeRepr = om; members = members)) = t + let (SynComponentInfo(longId = ids; range = r)) = ci let name = String.concat "." [ for i in ids -> i.idText ] ident <- ident + 1 @@ -269,7 +269,7 @@ let getNUnitTest (ast: ParsedInput) : TestAdapterEntry list = parent.Childs.Add entry match om with - | SynTypeDefnRepr.ObjectModel (_, ms, _) -> + | SynTypeDefnRepr.ObjectModel(_, ms, _) -> for m in ms do visitMember entry m | _ -> () @@ -281,7 +281,7 @@ let getNUnitTest (ast: ParsedInput) : TestAdapterEntry list = parent.Childs.Remove entry |> ignore and visitBinding parent b = - let (SynBinding (attributes = attrs; headPat = pat; range = r)) = b + let (SynBinding(attributes = attrs; headPat = pat; range = r)) = b if isNUnitTest attrs then ident <- ident + 1 @@ -299,11 +299,11 @@ let getNUnitTest (ast: ParsedInput) : TestAdapterEntry list = let rec visitDeclarations (parent: TestAdapterEntry) decls = for declaration in decls do match declaration with - | SynModuleDecl.Let (_, bindings, _) -> + | SynModuleDecl.Let(_, bindings, _) -> for b in bindings do visitBinding parent b - | SynModuleDecl.NestedModule (moduleInfo = ci; decls = decls) -> - let (SynComponentInfo (longId = ids; range = r)) = ci + | SynModuleDecl.NestedModule(moduleInfo = ci; decls = decls) -> + let (SynComponentInfo(longId = ids; range = r)) = ci let name = String.concat "." [ for i in ids -> i.idText ] ident <- ident + 1 @@ -320,14 +320,14 @@ let getNUnitTest (ast: ParsedInput) : TestAdapterEntry list = if entry.Childs.Count = 0 then parent.Childs.Remove entry |> ignore - | SynModuleDecl.Types (types, _) -> + | SynModuleDecl.Types(types, _) -> for t in types do visitTypeDef parent t | _ -> () let visitModulesAndNamespaces parent modulesOrNss = Seq.iter - (fun (SynModuleOrNamespace (ids, _, _, decls, _, _, _, r)) -> + (fun (SynModuleOrNamespace(ids, _, _, decls, _, _, _, r)) -> let name = String.concat "." [ for i in ids -> i.idText ] ident <- ident + 1 @@ -355,7 +355,7 @@ let getNUnitTest (ast: ParsedInput) : TestAdapterEntry list = Type = "" } match ast with - | ParsedInput.ImplFile (ParsedImplFileInput (modules = modules)) -> visitModulesAndNamespaces allTests modules + | ParsedInput.ImplFile(ParsedImplFileInput(modules = modules)) -> visitModulesAndNamespaces allTests modules | _ -> () List.ofSeq allTests.Childs @@ -378,22 +378,22 @@ let getXUnitTest ast : TestAdapterEntry list = let getName = function - | SynPat.Named (ident = name) -> name.idText - | SynPat.LongIdent(longDotId = LongIdentWithDots (ident, _)) -> ident |> List.last |> (fun n -> n.idText) + | SynPat.Named(ident = name) -> name.idText + | SynPat.LongIdent(longDotId = LongIdentWithDots(ident, _)) -> ident |> List.last |> (fun n -> n.idText) | _ -> "" let rec visitMember (parent: TestAdapterEntry) = function - | SynMemberDefn.Member (b, _) -> visitBinding parent b - | SynMemberDefn.LetBindings (bindings, _, _, _) -> + | SynMemberDefn.Member(b, _) -> visitBinding parent b + | SynMemberDefn.LetBindings(bindings, _, _, _) -> for b in bindings do visitBinding parent b - | SynMemberDefn.NestedType (typeDef, _, _) -> visitTypeDef parent typeDef + | SynMemberDefn.NestedType(typeDef, _, _) -> visitTypeDef parent typeDef | _ -> () and visitTypeDef parent t = - let (SynTypeDefn (typeInfo = ci; typeRepr = om; members = members)) = t - let (SynComponentInfo (longId = ids; range = r)) = ci + let (SynTypeDefn(typeInfo = ci; typeRepr = om; members = members)) = t + let (SynComponentInfo(longId = ids; range = r)) = ci let name = String.concat "." [ for i in ids -> i.idText ] ident <- ident + 1 @@ -408,7 +408,7 @@ let getXUnitTest ast : TestAdapterEntry list = parent.Childs.Add entry match om with - | SynTypeDefnRepr.ObjectModel (_, ms, _) -> + | SynTypeDefnRepr.ObjectModel(_, ms, _) -> for m in ms do visitMember entry m | _ -> () @@ -420,7 +420,7 @@ let getXUnitTest ast : TestAdapterEntry list = parent.Childs.Remove entry |> ignore and visitBinding parent b = - let (SynBinding (attributes = attrs; headPat = pat; range = r)) = b + let (SynBinding(attributes = attrs; headPat = pat; range = r)) = b if isXUnitTest attrs then ident <- ident + 1 @@ -440,11 +440,11 @@ let getXUnitTest ast : TestAdapterEntry list = let rec visitDeclarations (parent: TestAdapterEntry) decls = for declaration in decls do match declaration with - | SynModuleDecl.Let (_, bindings, _) -> + | SynModuleDecl.Let(_, bindings, _) -> for b in bindings do visitBinding parent b - | SynModuleDecl.NestedModule (moduleInfo = ci; decls = decls) -> - let (SynComponentInfo (longId = ids; range = r)) = ci + | SynModuleDecl.NestedModule(moduleInfo = ci; decls = decls) -> + let (SynComponentInfo(longId = ids; range = r)) = ci let name = String.concat "." [ for i in ids -> i.idText ] ident <- ident + 1 @@ -461,14 +461,14 @@ let getXUnitTest ast : TestAdapterEntry list = if entry.Childs.Count = 0 then parent.Childs.Remove entry |> ignore - | SynModuleDecl.Types (types, _) -> + | SynModuleDecl.Types(types, _) -> for t in types do visitTypeDef parent t | _ -> () let visitModulesAndNamespaces parent modulesOrNss = Seq.iter - (fun (SynModuleOrNamespace (ids, _, _, decls, _, _, _, r)) -> + (fun (SynModuleOrNamespace(ids, _, _, decls, _, _, _, r)) -> let name = String.concat "." [ for i in ids -> i.idText ] ident <- ident + 1 @@ -496,7 +496,7 @@ let getXUnitTest ast : TestAdapterEntry list = Type = "" } match ast with - | ParsedInput.ImplFile (ParsedImplFileInput (modules = modules)) -> visitModulesAndNamespaces allTests modules + | ParsedInput.ImplFile(ParsedImplFileInput(modules = modules)) -> visitModulesAndNamespaces allTests modules | _ -> () List.ofSeq allTests.Childs diff --git a/src/FsAutoComplete.Core/TipFormatter.fs b/src/FsAutoComplete.Core/TipFormatter.fs index 4d30a1e73..14b7a4c82 100644 --- a/src/FsAutoComplete.Core/TipFormatter.fs +++ b/src/FsAutoComplete.Core/TipFormatter.fs @@ -156,7 +156,7 @@ module private Format = function | VoidElement _ -> None - | NonVoidElement (innerText, attributes) -> + | NonVoidElement(innerText, attributes) -> let lang = match lang attributes with | Some lang -> lang @@ -186,7 +186,7 @@ module private Format = Formatter = function | VoidElement _ -> None - | NonVoidElement (innerText, _) -> "`" + innerText + "`" |> Some } + | NonVoidElement(innerText, _) -> "`" + innerText + "`" |> Some } |> applyFormatter let private link text uri = $"[`%s{text}`](%s{uri})" @@ -201,7 +201,7 @@ module private Format = | Some href -> Some(link href href) | None -> None - | NonVoidElement (innerText, attributes) -> + | NonVoidElement(innerText, attributes) -> match href attributes with | Some href -> Some(link innerText href) | None -> Some(code innerText) } @@ -213,7 +213,7 @@ module private Format = function | VoidElement _ -> None - | NonVoidElement (innerText, _) -> nl + innerText + nl |> Some } + | NonVoidElement(innerText, _) -> nl + innerText + nl |> Some } |> applyFormatter let private block = @@ -222,7 +222,7 @@ module private Format = function | VoidElement _ -> None - | NonVoidElement (innerText, _) -> nl + innerText + nl |> Some } + | NonVoidElement(innerText, _) -> nl + innerText + nl |> Some } |> applyFormatter let private see = @@ -240,7 +240,7 @@ module private Format = Formatter = function | VoidElement attributes -> formatFromAttributes attributes - | NonVoidElement (innerText, attributes) -> + | NonVoidElement(innerText, attributes) -> if String.IsNullOrWhiteSpace innerText then formatFromAttributes attributes else @@ -258,7 +258,7 @@ module private Format = | Some href -> Some(link href href) | None -> None - | NonVoidElement (innerText, attributes) -> + | NonVoidElement(innerText, attributes) -> if String.IsNullOrWhiteSpace innerText then match href attributes with | Some href -> Some(link innerText href) @@ -276,7 +276,7 @@ module private Format = | Some name -> Some(code name) | None -> None - | NonVoidElement (innerText, attributes) -> + | NonVoidElement(innerText, attributes) -> if String.IsNullOrWhiteSpace innerText then match name attributes with | Some name -> @@ -298,7 +298,7 @@ module private Format = | Some name -> Some(code name) | None -> None - | NonVoidElement (innerText, attributes) -> + | NonVoidElement(innerText, attributes) -> if String.IsNullOrWhiteSpace innerText then match name attributes with | Some name -> @@ -410,16 +410,16 @@ module private Format = Regex.Matches(text, invalidOrBlockPattern, RegexOptions.Multiline) |> Seq.cast |> Seq.fold - (fun (state: string) (m: Match) -> - let orText = m.Groups.["or_text"] + (fun (state: string) (m: Match) -> + let orText = m.Groups.["or_text"] - if orText.Success then - let replacement = orText.Value.Replace("-or-", "or") + if orText.Success then + let replacement = orText.Value.Replace("-or-", "or") - state.Replace(orText.Value, replacement) - else - state) - text + state.Replace(orText.Value, replacement) + else + state) + text let private convertTable = @@ -428,7 +428,7 @@ module private Format = function | VoidElement _ -> None - | NonVoidElement (innerText, _) -> + | NonVoidElement(innerText, _) -> let rowCount = Regex.Matches(innerText, "").Count @@ -477,7 +477,7 @@ module private Format = match item with | DescriptionOnly description -> prefix + " " + description | TermOnly term -> prefix + " " + "**" + term + "**" - | Definitions (term, description) -> prefix + " " + "**" + term + "** - " + description + | Definitions(term, description) -> prefix + " " + "**" + term + "** - " + description let private list = let getType (attributes: Map) = Map.tryFind "type" attributes @@ -540,7 +540,7 @@ module private Format = let rec extractAllTerms (res: string list) (text: string) = match tryGetNonVoidElement text "term" with - | Some (fullString, innerText) -> + | Some(fullString, innerText) -> let escapedRegex = Regex(Regex.Escape(fullString)) let newText = escapedRegex.Replace(text, "", 1) extractAllTerms (res @ [ innerText ]) newText @@ -562,7 +562,7 @@ module private Format = let rec extractAllTerms (res: string list) (text: string) = match tryGetNonVoidElement text "term" with - | Some (fullString, innerText) -> + | Some(fullString, innerText) -> let escapedRegex = Regex(Regex.Escape(fullString)) let newText = escapedRegex.Replace(text, "", 1) extractAllTerms (res @ [ innerText ]) newText @@ -578,7 +578,7 @@ module private Format = function | VoidElement _ -> None - | NonVoidElement (innerText, attributes) -> + | NonVoidElement(innerText, attributes) -> let listStyle = match getType attributes with | Some "bullet" -> Bulleted @@ -942,7 +942,7 @@ let private buildFormatComment cmt (formatStyle: FormatCommentStyle) (typeDoc: s sprintf "An error occured when parsing the doc comment, please check that your doc comment is valid.\n\nMore info can be found LSP output" - | FSharpXmlDoc.FromXmlFile (dllFile, memberName) -> + | FSharpXmlDoc.FromXmlFile(dllFile, memberName) -> match getXmlDoc dllFile with | Some doc when doc.ContainsKey memberName -> let typeDoc = @@ -1031,7 +1031,7 @@ let formatCompletionItemTip (ToolTipText tips) : (string * string) = items |> List.tryHead |> Option.map makeTooltip - | ToolTipElement.CompositionError (error) -> Some("", error) + | ToolTipElement.CompositionError(error) -> Some("", error) | _ -> Some("", "No signature data")) /// Formats a tooltip signature for output as a signatureHelp, @@ -1044,7 +1044,7 @@ let formatPlainTip (ToolTipText tips) : (string * string) = let signature = formatUntaggedTexts t.MainDescription let description = buildFormatComment t.XmlDoc FormatCommentStyle.Legacy None Some(signature, description) - | ToolTipElement.CompositionError (error) -> Some("", error) + | ToolTipElement.CompositionError(error) -> Some("", error) | _ -> Some("", "No signature data")) let formatTipEnhanced @@ -1074,12 +1074,13 @@ let formatTipEnhanced (signature, comment, footer)) ) - | ToolTipElement.CompositionError (error) -> Some [ ("", error, "") ] + | ToolTipElement.CompositionError(error) -> Some [ ("", error, "") ] | _ -> None) let formatDocumentation (ToolTipText tips) - ((signature, (constructors, fields, functions, interfaces, attrs, ts)): string * (string[] * string[] * string[] * string[] * string[] * string[])) + ((signature, (constructors, fields, functions, interfaces, attrs, ts)): + string * (string[] * string[] * string[] * string[] * string[] * string[])) (footer: string) (cn: string) = @@ -1103,13 +1104,14 @@ let formatDocumentation (signature, constructors, fields, functions, interfaces, attrs, ts, comment, footer, cn)) ) - | ToolTipElement.CompositionError (error) -> Some [ ("", [||], [||], [||], [||], [||], [||], error, "", "") ] + | ToolTipElement.CompositionError(error) -> Some [ ("", [||], [||], [||], [||], [||], [||], error, "", "") ] | _ -> None) let formatDocumentationFromXmlSig (xmlSig: string) (assembly: string) - ((signature, (constructors, fields, functions, interfaces, attrs, ts)): string * (string[] * string[] * string[] * string[] * string[] * string[])) + ((signature, (constructors, fields, functions, interfaces, attrs, ts)): + string * (string[] * string[] * string[] * string[] * string[] * string[])) (footer: string) (cn: string) = diff --git a/src/FsAutoComplete.Core/TypedAstPatterns.fs b/src/FsAutoComplete.Core/TypedAstPatterns.fs index 1a623f9dd..d97ac4c10 100644 --- a/src/FsAutoComplete.Core/TypedAstPatterns.fs +++ b/src/FsAutoComplete.Core/TypedAstPatterns.fs @@ -86,13 +86,13 @@ module SymbolUse = let (|TypeAbbreviation|_|) = function - | Entity (entity, _) when entity.IsFSharpAbbreviation -> Some entity + | Entity(entity, _) when entity.IsFSharpAbbreviation -> Some entity | _ -> None let (|Class|_|) = function - | Entity (entity, _) when entity.IsClass -> Some entity - | Entity (entity, _) when + | Entity(entity, _) when entity.IsClass -> Some entity + | Entity(entity, _) when entity.IsFSharp && entity.IsOpaque && not entity.IsFSharpModule @@ -108,7 +108,7 @@ module SymbolUse = let (|Delegate|_|) = function - | Entity (entity, _) when entity.IsDelegate -> Some entity + | Entity(entity, _) when entity.IsDelegate -> Some entity | _ -> None let (|Event|_|) = @@ -209,37 +209,37 @@ module SymbolUse = let (|Enum|_|) = function - | Entity (entity, _) when entity.IsEnum -> Some entity + | Entity(entity, _) when entity.IsEnum -> Some entity | _ -> None let (|Interface|_|) = function - | Entity (entity, _) when entity.IsInterface -> Some entity + | Entity(entity, _) when entity.IsInterface -> Some entity | _ -> None let (|Module|_|) = function - | Entity (entity, _) when entity.IsFSharpModule -> Some entity + | Entity(entity, _) when entity.IsFSharpModule -> Some entity | _ -> None let (|Namespace|_|) = function - | Entity (entity, _) when entity.IsNamespace -> Some entity + | Entity(entity, _) when entity.IsNamespace -> Some entity | _ -> None let (|Record|_|) = function - | Entity (entity, _) when entity.IsFSharpRecord -> Some entity + | Entity(entity, _) when entity.IsFSharpRecord -> Some entity | _ -> None let (|Union|_|) = function - | Entity (entity, _) when entity.IsFSharpUnion -> Some entity + | Entity(entity, _) when entity.IsFSharpUnion -> Some entity | _ -> None let (|ValueType|_|) = function - | Entity (entity, _) when entity.IsValueType && not entity.IsEnum -> Some entity + | Entity(entity, _) when entity.IsValueType && not entity.IsEnum -> Some entity | _ -> None let (|ComputationExpression|_|) (symbol: FSharpSymbolUse) = @@ -250,7 +250,7 @@ module SymbolUse = let (|Attribute|_|) = function - | Entity (entity, _) when entity.IsAttributeType -> Some entity + | Entity(entity, _) when entity.IsAttributeType -> Some entity | _ -> None [] @@ -348,7 +348,7 @@ module SymbolPatterns = let getBaseType (entity: FSharpEntity) = try match entity.BaseType with - | Some (TypeWithDefinition def) -> Some def + | Some(TypeWithDefinition def) -> Some def | _ -> None with _ -> None diff --git a/src/FsAutoComplete.Core/TypedAstUtils.fs b/src/FsAutoComplete.Core/TypedAstUtils.fs index 63d0d8871..75f6e5221 100644 --- a/src/FsAutoComplete.Core/TypedAstUtils.fs +++ b/src/FsAutoComplete.Core/TypedAstUtils.fs @@ -51,7 +51,8 @@ module TypedAstUtils = let res = match arg with | :? int32 as arg when arg = int CompilationRepresentationFlags.ModuleSuffix -> Some() - | :? CompilationRepresentationFlags as arg when arg = CompilationRepresentationFlags.ModuleSuffix -> Some() + | :? CompilationRepresentationFlags as arg when arg = CompilationRepresentationFlags.ModuleSuffix -> + Some() | _ -> None res))) diff --git a/src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs b/src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs index 457e8217e..c2546bdd3 100644 --- a/src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs +++ b/src/FsAutoComplete.Core/UnionPatternMatchCaseGenerator.fs @@ -34,21 +34,21 @@ type private Context = Qualifier: string option } -let private clauseIsCandidateForCodeGen (cursorPos: Position) (SynMatchClause (pat, _, _, _, _, _)) = +let private clauseIsCandidateForCodeGen (cursorPos: Position) (SynMatchClause(pat, _, _, _, _, _)) = let rec patIsCandidate (pat: SynPat) = match pat with - | SynPat.Paren (innerPat, _) - | SynPat.Attrib (innerPat, _, _) -> patIsCandidate innerPat - | SynPat.Const (_, _) -> false - | SynPat.Wild (_) -> false + | SynPat.Paren(innerPat, _) + | SynPat.Attrib(innerPat, _, _) -> patIsCandidate innerPat + | SynPat.Const(_, _) -> false + | SynPat.Wild(_) -> false // TODO: check if we have to handle these cases - | SynPat.Typed (innerPat, _, _) -> patIsCandidate innerPat - | SynPat.OptionalVal (_, _) -> false - | SynPat.Or (lhsPat = leftPat; rhsPat = rightPat) -> patIsCandidate leftPat || patIsCandidate rightPat - | SynPat.Ands (innerPatList, _) -> List.exists patIsCandidate innerPatList + | SynPat.Typed(innerPat, _, _) -> patIsCandidate innerPat + | SynPat.OptionalVal(_, _) -> false + | SynPat.Or(lhsPat = leftPat; rhsPat = rightPat) -> patIsCandidate leftPat || patIsCandidate rightPat + | SynPat.Ands(innerPatList, _) -> List.exists patIsCandidate innerPatList // This is the 'hd :: tail -> ...' pattern - | SynPat.LongIdent(longDotId = LongIdentWithDots ([ ident ], [])) when ident.idText = "op_ColonColon" -> false - | SynPat.LongIdent (argPats = ConstructorPats nestedPats; range = r) -> + | SynPat.LongIdent(longDotId = LongIdentWithDots([ ident ], [])) when ident.idText = "op_ColonColon" -> false + | SynPat.LongIdent(argPats = ConstructorPats nestedPats; range = r) -> // The cursor should not be in the nested patterns Range.rangeContainsPos r cursorPos && List.forall (not << patIsCandidate) nestedPats @@ -69,37 +69,36 @@ let private clauseIsCandidateForCodeGen (cursorPos: Position) (SynMatchClause (p let private posIsInLhsOfClause (pos: Position) (clause: SynMatchClause) = match clause with - | SynMatchClause (whenExpr = None; range = patternRange) -> Range.rangeContainsPos patternRange pos - | SynMatchClause (whenExpr = Some guardExpr; range = patternRange) -> + | SynMatchClause(whenExpr = None; range = patternRange) -> Range.rangeContainsPos patternRange pos + | SynMatchClause(whenExpr = Some guardExpr; range = patternRange) -> Range.rangeContainsPos (Range.unionRanges guardExpr.Range patternRange) pos let private tryFindPatternMatchExprInParsedInput (pos: Position) (parsedInput: ParsedInput) = let inline getIfPosInRange range f = if Range.rangeContainsPos range pos then f () else None - let rec walkImplFileInput (ParsedImplFileInput (modules = moduleOrNamespaceList)) = + let rec walkImplFileInput (ParsedImplFileInput(modules = moduleOrNamespaceList)) = List.tryPick walkSynModuleOrNamespace moduleOrNamespaceList - and walkSynModuleOrNamespace (SynModuleOrNamespace (_, _, _, decls, _, _, _, range)) = + and walkSynModuleOrNamespace (SynModuleOrNamespace(_, _, _, decls, _, _, _, range)) = getIfPosInRange range (fun () -> List.tryPick walkSynModuleDecl decls) and walkSynModuleDecl (decl: SynModuleDecl) = getIfPosInRange decl.Range (fun () -> match decl with - | SynModuleDecl.Exception (SynExceptionDefn (members = synMembers), _) -> - List.tryPick walkSynMemberDefn synMembers - | SynModuleDecl.Let (_isRecursive, bindings, _range) -> List.tryPick walkBinding bindings - | SynModuleDecl.ModuleAbbrev (_lhs, _rhs, _range) -> None - | SynModuleDecl.NamespaceFragment (fragment) -> walkSynModuleOrNamespace fragment - | SynModuleDecl.NestedModule (decls = modules) -> List.tryPick walkSynModuleDecl modules - | SynModuleDecl.Types (typeDefs, _range) -> List.tryPick walkSynTypeDefn typeDefs - | SynModuleDecl.Expr (expr = expr) -> walkExpr expr + | SynModuleDecl.Exception(SynExceptionDefn(members = synMembers), _) -> List.tryPick walkSynMemberDefn synMembers + | SynModuleDecl.Let(_isRecursive, bindings, _range) -> List.tryPick walkBinding bindings + | SynModuleDecl.ModuleAbbrev(_lhs, _rhs, _range) -> None + | SynModuleDecl.NamespaceFragment(fragment) -> walkSynModuleOrNamespace fragment + | SynModuleDecl.NestedModule(decls = modules) -> List.tryPick walkSynModuleDecl modules + | SynModuleDecl.Types(typeDefs, _range) -> List.tryPick walkSynTypeDefn typeDefs + | SynModuleDecl.Expr(expr = expr) -> walkExpr expr | SynModuleDecl.Attributes _ | SynModuleDecl.HashDirective _ | SynModuleDecl.Open _ -> None) and walkSynTypeDefn - (SynTypeDefn (typeRepr = representation; members = members; implicitConstructor = implicitCtor; range = range)) + (SynTypeDefn(typeRepr = representation; members = members; implicitConstructor = implicitCtor; range = range)) = getIfPosInRange range (fun () -> walkSynTypeDefnRepr representation @@ -109,70 +108,70 @@ let private tryFindPatternMatchExprInParsedInput (pos: Position) (parsedInput: P and walkSynTypeDefnRepr (typeDefnRepr: SynTypeDefnRepr) = getIfPosInRange typeDefnRepr.Range (fun () -> match typeDefnRepr with - | SynTypeDefnRepr.ObjectModel (_kind, members, _range) -> List.tryPick walkSynMemberDefn members + | SynTypeDefnRepr.ObjectModel(_kind, members, _range) -> List.tryPick walkSynMemberDefn members | SynTypeDefnRepr.Simple _ | SynTypeDefnRepr.Exception _ -> None) and walkSynMemberDefn (memberDefn: SynMemberDefn) = getIfPosInRange memberDefn.Range (fun () -> match memberDefn with - | SynMemberDefn.AbstractSlot (_synValSig, _memberFlags, _range) -> None - | SynMemberDefn.AutoProperty (synExpr = expr) -> walkExpr expr - | SynMemberDefn.Interface (members = members) -> Option.bind (List.tryPick walkSynMemberDefn) members - | SynMemberDefn.Member (binding, _range) -> walkBinding binding - | SynMemberDefn.NestedType (typeDef, _access, _range) -> walkSynTypeDefn typeDef - | SynMemberDefn.ValField (_field, _range) -> None - | SynMemberDefn.LetBindings (bindings, _isStatic, _isRec, _range) -> List.tryPick walkBinding bindings + | SynMemberDefn.AbstractSlot(_synValSig, _memberFlags, _range) -> None + | SynMemberDefn.AutoProperty(synExpr = expr) -> walkExpr expr + | SynMemberDefn.Interface(members = members) -> Option.bind (List.tryPick walkSynMemberDefn) members + | SynMemberDefn.Member(binding, _range) -> walkBinding binding + | SynMemberDefn.NestedType(typeDef, _access, _range) -> walkSynTypeDefn typeDef + | SynMemberDefn.ValField(_field, _range) -> None + | SynMemberDefn.LetBindings(bindings, _isStatic, _isRec, _range) -> List.tryPick walkBinding bindings | SynMemberDefn.Open _ | SynMemberDefn.ImplicitInherit _ | SynMemberDefn.Inherit _ | SynMemberDefn.ImplicitCtor _ -> None) - and walkBinding (SynBinding (expr = expr) as binding) = + and walkBinding (SynBinding(expr = expr) as binding) = getIfPosInRange binding.RangeOfBindingWithRhs (fun () -> walkExpr expr) and walkExpr expr = getIfPosInRange expr.Range (fun () -> match expr with - | SynExpr.Quote (synExpr1, _, synExpr2, _, _range) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] + | SynExpr.Quote(synExpr1, _, synExpr2, _, _range) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] - | SynExpr.Const (_synConst, _range) -> None + | SynExpr.Const(_synConst, _range) -> None - | SynExpr.Typed (synExpr, _, _) - | SynExpr.Paren (synExpr, _, _, _) - | SynExpr.New (_, _, synExpr, _) - | SynExpr.ArrayOrListComputed (_, synExpr, _) - | SynExpr.ComputationExpr (_, synExpr, _) - | SynExpr.Lambda (body = synExpr) - | SynExpr.Lazy (synExpr, _) - | SynExpr.Do (synExpr, _) - | SynExpr.Assert (synExpr, _) -> walkExpr synExpr + | SynExpr.Typed(synExpr, _, _) + | SynExpr.Paren(synExpr, _, _, _) + | SynExpr.New(_, _, synExpr, _) + | SynExpr.ArrayOrListComputed(_, synExpr, _) + | SynExpr.ComputationExpr(_, synExpr, _) + | SynExpr.Lambda(body = synExpr) + | SynExpr.Lazy(synExpr, _) + | SynExpr.Do(synExpr, _) + | SynExpr.Assert(synExpr, _) -> walkExpr synExpr - | SynExpr.Tuple (_, synExprList, _, _range) - | SynExpr.ArrayOrList (_, synExprList, _range) -> List.tryPick walkExpr synExprList + | SynExpr.Tuple(_, synExprList, _, _range) + | SynExpr.ArrayOrList(_, synExprList, _range) -> List.tryPick walkExpr synExprList - | SynExpr.Record (_inheritOpt, copyOpt, fields, _range) -> + | SynExpr.Record(_inheritOpt, copyOpt, fields, _range) -> let fieldExprList = - fields |> List.choose (fun (SynExprRecordField (expr = expr)) -> expr) + fields |> List.choose (fun (SynExprRecordField(expr = expr)) -> expr) match copyOpt with - | Some (copyExpr, _blockSeparator) -> List.tryPick walkExpr (copyExpr :: fieldExprList) + | Some(copyExpr, _blockSeparator) -> List.tryPick walkExpr (copyExpr :: fieldExprList) | None -> List.tryPick walkExpr fieldExprList - | SynExpr.ObjExpr (bindings = binds; extraImpls = ifaces) -> + | SynExpr.ObjExpr(bindings = binds; extraImpls = ifaces) -> List.tryPick walkBinding binds |> Option.orElseWith (fun _ -> List.tryPick walkSynInterfaceImpl ifaces) - | SynExpr.While (_sequencePointInfoForWhileLoop, synExpr1, synExpr2, _range) -> + | SynExpr.While(_sequencePointInfoForWhileLoop, synExpr1, synExpr2, _range) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] - | SynExpr.ForEach (enumExpr = synExpr1; bodyExpr = synExpr2) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] + | SynExpr.ForEach(enumExpr = synExpr1; bodyExpr = synExpr2) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] - | SynExpr.For (identBody = synExpr1; toBody = synExpr2; doBody = synExpr3) -> + | SynExpr.For(identBody = synExpr1; toBody = synExpr2; doBody = synExpr3) -> List.tryPick walkExpr [ synExpr1; synExpr2; synExpr3 ] - | SynExpr.MatchLambda (isExnMatch, functionKeywordRange, synMatchClauseList, _, _wholeExprRange) as matchLambdaExpr -> + | SynExpr.MatchLambda(isExnMatch, functionKeywordRange, synMatchClauseList, _, _wholeExprRange) as matchLambdaExpr -> synMatchClauseList - |> List.tryPick (fun (SynMatchClause (resultExpr = e)) -> walkExpr e) + |> List.tryPick (fun (SynMatchClause(resultExpr = e)) -> walkExpr e) |> Option.orElseWith (fun () -> if isExnMatch then None @@ -191,11 +190,11 @@ let private tryFindPatternMatchExprInParsedInput (pos: Position) (parsedInput: P else None) - | SynExpr.Match (matchDebugPoint = debugPoint; expr = synExpr; clauses = synMatchClauseList) as matchExpr -> + | SynExpr.Match(matchDebugPoint = debugPoint; expr = synExpr; clauses = synMatchClauseList) as matchExpr -> getIfPosInRange synExpr.Range (fun () -> walkExpr synExpr) |> Option.orElseWith (fun () -> synMatchClauseList - |> List.tryPick (fun (SynMatchClause (resultExpr = e)) -> walkExpr e)) + |> List.tryPick (fun (SynMatchClause(resultExpr = e)) -> walkExpr e)) |> Option.orElseWith (fun () -> let currentClause = List.tryFind (posIsInLhsOfClause pos) synMatchClauseList @@ -214,64 +213,64 @@ let private tryFindPatternMatchExprInParsedInput (pos: Position) (parsedInput: P else None) - | SynExpr.App (_exprAtomicFlag, _isInfix, synExpr1, synExpr2, _range) -> + | SynExpr.App(_exprAtomicFlag, _isInfix, synExpr1, synExpr2, _range) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] - | SynExpr.TypeApp (synExpr, _, _synTypeList, _commas, _, _, _range) -> walkExpr synExpr + | SynExpr.TypeApp(synExpr, _, _synTypeList, _commas, _, _, _range) -> walkExpr synExpr - | SynExpr.LetOrUse (body = synExpr; bindings = synBindingList) -> + | SynExpr.LetOrUse(body = synExpr; bindings = synBindingList) -> walkExpr synExpr |> Option.orElseWith (fun _ -> List.tryPick walkBinding synBindingList) - | SynExpr.TryWith (tryExpr = synExpr) -> walkExpr synExpr + | SynExpr.TryWith(tryExpr = synExpr) -> walkExpr synExpr - | SynExpr.TryFinally (tryExpr = synExpr1; finallyExpr = synExpr2) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] + | SynExpr.TryFinally(tryExpr = synExpr1; finallyExpr = synExpr2) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] | Sequentials exprs -> List.tryPick walkExpr exprs - | SynExpr.IfThenElse (ifExpr = synExpr1; thenExpr = synExpr2; elseExpr = synExprOpt) -> + | SynExpr.IfThenElse(ifExpr = synExpr1; thenExpr = synExpr2; elseExpr = synExprOpt) -> match synExprOpt with | Some synExpr3 -> List.tryPick walkExpr [ synExpr1; synExpr2; synExpr3 ] | None -> List.tryPick walkExpr [ synExpr1; synExpr2 ] - | SynExpr.Ident (_ident) -> None - | SynExpr.LongIdent (_, _longIdent, _altNameRefCell, _range) -> None + | SynExpr.Ident(_ident) -> None + | SynExpr.LongIdent(_, _longIdent, _altNameRefCell, _range) -> None - | SynExpr.LongIdentSet (_longIdent, synExpr, _range) -> walkExpr synExpr - | SynExpr.DotGet (synExpr, _dotm, _longIdent, _range) -> walkExpr synExpr + | SynExpr.LongIdentSet(_longIdent, synExpr, _range) -> walkExpr synExpr + | SynExpr.DotGet(synExpr, _dotm, _longIdent, _range) -> walkExpr synExpr - | SynExpr.DotSet (synExpr1, _longIdent, synExpr2, _range) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] + | SynExpr.DotSet(synExpr1, _longIdent, synExpr2, _range) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] - | SynExpr.DotIndexedGet (synExpr, argList, _range, _range2) -> walkExpr argList + | SynExpr.DotIndexedGet(synExpr, argList, _range, _range2) -> walkExpr argList - | SynExpr.DotIndexedSet (synExpr1, argList, synExpr2, _, _range, _range2) -> + | SynExpr.DotIndexedSet(synExpr1, argList, synExpr2, _, _range, _range2) -> [ synExpr1; argList; synExpr2 ] |> List.tryPick walkExpr - | SynExpr.JoinIn (synExpr1, _range, synExpr2, _range2) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] - | SynExpr.NamedIndexedPropertySet (_longIdent, synExpr1, synExpr2, _range) -> + | SynExpr.JoinIn(synExpr1, _range, synExpr2, _range2) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] + | SynExpr.NamedIndexedPropertySet(_longIdent, synExpr1, synExpr2, _range) -> List.tryPick walkExpr [ synExpr1; synExpr2 ] - | SynExpr.DotNamedIndexedPropertySet (synExpr1, _longIdent, synExpr2, synExpr3, _range) -> + | SynExpr.DotNamedIndexedPropertySet(synExpr1, _longIdent, synExpr2, synExpr3, _range) -> List.tryPick walkExpr [ synExpr1; synExpr2; synExpr3 ] - | SynExpr.TypeTest (synExpr, _synType, _range) - | SynExpr.Upcast (synExpr, _synType, _range) - | SynExpr.Downcast (synExpr, _synType, _range) -> walkExpr synExpr - | SynExpr.InferredUpcast (synExpr, _range) - | SynExpr.InferredDowncast (synExpr, _range) -> walkExpr synExpr - | SynExpr.AddressOf (_, synExpr, _range, _range2) -> walkExpr synExpr - | SynExpr.TraitCall (_synTyparList, _synMemberSig, synExpr, _range) -> walkExpr synExpr + | SynExpr.TypeTest(synExpr, _synType, _range) + | SynExpr.Upcast(synExpr, _synType, _range) + | SynExpr.Downcast(synExpr, _synType, _range) -> walkExpr synExpr + | SynExpr.InferredUpcast(synExpr, _range) + | SynExpr.InferredDowncast(synExpr, _range) -> walkExpr synExpr + | SynExpr.AddressOf(_, synExpr, _range, _range2) -> walkExpr synExpr + | SynExpr.TraitCall(_synTyparList, _synMemberSig, synExpr, _range) -> walkExpr synExpr - | SynExpr.Null (_range) - | SynExpr.ImplicitZero (_range) -> None + | SynExpr.Null(_range) + | SynExpr.ImplicitZero(_range) -> None - | SynExpr.YieldOrReturn (_, synExpr, _range) - | SynExpr.YieldOrReturnFrom (_, synExpr, _range) - | SynExpr.DoBang (synExpr, _range) -> walkExpr synExpr + | SynExpr.YieldOrReturn(_, synExpr, _range) + | SynExpr.YieldOrReturnFrom(_, synExpr, _range) + | SynExpr.DoBang(synExpr, _range) -> walkExpr synExpr - | SynExpr.LetOrUseBang (rhs = synExpr1; andBangs = ands; body = synExpr2) -> + | SynExpr.LetOrUseBang(rhs = synExpr1; andBangs = ands; body = synExpr2) -> [ synExpr1 - yield! ands |> List.map (fun (SynExprAndBang (body = body)) -> body) + yield! ands |> List.map (fun (SynExprAndBang(body = body)) -> body) synExpr2 ] |> List.tryPick walkExpr @@ -279,14 +278,14 @@ let private tryFindPatternMatchExprInParsedInput (pos: Position) (parsedInput: P | SynExpr.LibraryOnlyStaticOptimization _ | SynExpr.LibraryOnlyUnionCaseFieldGet _ | SynExpr.LibraryOnlyUnionCaseFieldSet _ -> None - | SynExpr.ArbitraryAfterError (_debugStr, _range) -> None + | SynExpr.ArbitraryAfterError(_debugStr, _range) -> None - | SynExpr.FromParseError (synExpr, _range) - | SynExpr.DiscardAfterMissingQualificationAfterDot (synExpr, _range) -> walkExpr synExpr + | SynExpr.FromParseError(synExpr, _range) + | SynExpr.DiscardAfterMissingQualificationAfterDot(synExpr, _range) -> walkExpr synExpr | _ -> None) - and walkSynInterfaceImpl (SynInterfaceImpl (bindings = synBindings)) = List.tryPick walkBinding synBindings + and walkSynInterfaceImpl (SynInterfaceImpl(bindings = synBindings)) = List.tryPick walkBinding synBindings match parsedInput with | ParsedInput.SigFile _input -> None @@ -295,33 +294,33 @@ let private tryFindPatternMatchExprInParsedInput (pos: Position) (parsedInput: P let getWrittenCases (patMatchExpr: PatternMatchExpr) = let rec checkPattern pat = match pat with - | SynPat.Const (_const, _) -> false + | SynPat.Const(_const, _) -> false // TODO: figure out if these cases are supposed to happen or not - | SynPat.Or (_) - | SynPat.Ands (_, _) - | SynPat.LongIdent (_) - | SynPat.ArrayOrList (_, _, _) - | SynPat.Null (_) - | SynPat.InstanceMember (_, _, _, _, _) - | SynPat.IsInst (_, _) - | SynPat.QuoteExpr (_, _) - | SynPat.DeprecatedCharRange (_, _, _) - | SynPat.FromParseError (_, _) -> false - - | SynPat.Tuple (_, innerPatList, _) -> List.forall checkPattern innerPatList - - | SynPat.Record (recordInnerPatList, _) -> + | SynPat.Or(_) + | SynPat.Ands(_, _) + | SynPat.LongIdent(_) + | SynPat.ArrayOrList(_, _, _) + | SynPat.Null(_) + | SynPat.InstanceMember(_, _, _, _, _) + | SynPat.IsInst(_, _) + | SynPat.QuoteExpr(_, _) + | SynPat.DeprecatedCharRange(_, _, _) + | SynPat.FromParseError(_, _) -> false + + | SynPat.Tuple(_, innerPatList, _) -> List.forall checkPattern innerPatList + + | SynPat.Record(recordInnerPatList, _) -> recordInnerPatList |> List.map (fun (_, _, innerPat) -> innerPat) |> List.forall checkPattern - | SynPat.OptionalVal (_, _) -> true - | SynPat.Named (_) - | SynPat.Wild (_) -> true - | SynPat.Typed (innerPat, _, _) - | SynPat.Attrib (innerPat, _, _) - | SynPat.Paren (innerPat, _) -> checkPattern innerPat - | SynPat.As (lhsPat, rhsPat, _range) -> checkPattern lhsPat && checkPattern rhsPat + | SynPat.OptionalVal(_, _) -> true + | SynPat.Named(_) + | SynPat.Wild(_) -> true + | SynPat.Typed(innerPat, _, _) + | SynPat.Attrib(innerPat, _, _) + | SynPat.Paren(innerPat, _) -> checkPattern innerPat + | SynPat.As(lhsPat, rhsPat, _range) -> checkPattern lhsPat && checkPattern rhsPat let getIfArgsAreFree constructorArgs func = match constructorArgs with @@ -330,7 +329,7 @@ let getWrittenCases (patMatchExpr: PatternMatchExpr) = Some(func ()) else None - | SynArgPats.NamePatPairs (namedPatList, _) -> + | SynArgPats.NamePatPairs(namedPatList, _) -> let patList = namedPatList |> List.unzip3 |> (fun (_, _, pat) -> pat) if List.forall checkPattern patList then @@ -340,7 +339,7 @@ let getWrittenCases (patMatchExpr: PatternMatchExpr) = let rec getCasesInPattern (pat: SynPat) = match pat with - | SynPat.LongIdent (longDotId = LongIdentWithDots (unionCaseLongIdent, _); argPats = constructorArgs) -> + | SynPat.LongIdent(longDotId = LongIdentWithDots(unionCaseLongIdent, _); argPats = constructorArgs) -> // Get list of qualifiers, this can be checked for length later. let reversedIdents = unionCaseLongIdent |> List.map (fun id -> id.idText) |> List.rev @@ -351,18 +350,18 @@ let getWrittenCases (patMatchExpr: PatternMatchExpr) = getIfArgsAreFree constructorArgs (fun () -> [ (name, quals |> List.rev) ]) |> Option.defaultValue [] - | SynPat.Or (lhsPat = left; rhsPat = right) -> (getCasesInPattern left) @ (getCasesInPattern right) - | SynPat.Ands (patList, _) -> + | SynPat.Or(lhsPat = left; rhsPat = right) -> (getCasesInPattern left) @ (getCasesInPattern right) + | SynPat.Ands(patList, _) -> patList |> List.map (getCasesInPattern >> Set.ofList) |> Set.intersectMany |> Set.toList - | SynPat.Paren (innerPat, _) -> getCasesInPattern innerPat + | SynPat.Paren(innerPat, _) -> getCasesInPattern innerPat | _ -> [] let rec getCasesInClause (x: SynMatchClause) = match x with - | SynMatchClause (pat, None, _, _, _, _) -> getCasesInPattern pat + | SynMatchClause(pat, None, _, _, _, _) -> getCasesInPattern pat | _ -> [] patMatchExpr.Clauses |> List.collect (getCasesInClause) |> Set.ofList @@ -458,7 +457,7 @@ let tryFindInsertionParams (codeGenService: ICodeGenerationService) document (pa tryFindBarTokenLPosInRange codeGenService possibleBarLocationRange document match barTokenOpt with - | Some (_, barTokenLPos) -> + | Some(_, barTokenLPos) -> { IndentColumn = barTokenLPos.Column InsertionPos = last.Range.End } |> Some @@ -477,7 +476,7 @@ let checkThatPatternMatchExprEndsWithCompleteClause (expr: PatternMatchExpr) = // In the case when there's nothing in the RHS of the arrow // FCS compiler apparently uses this particular AST representation // but with unitRange = empty - | SynMatchClause(resultExpr = SynExpr.Const (SynConst.Unit, unitRange)) -> + | SynMatchClause(resultExpr = SynExpr.Const(SynConst.Unit, unitRange)) -> let rhsExprExists = unitRange.StartLine <> unitRange.EndLine || unitRange.StartColumn <> unitRange.EndColumn @@ -510,9 +509,9 @@ let tryFindUnionDefinitionFromPos (codeGenService: ICodeGenerationService) pos d let! symbolUse = symbolUse match symbolUse.Symbol with - | SymbolPatterns.UnionCase (case) when case.ReturnType.HasTypeDefinition -> + | SymbolPatterns.UnionCase(case) when case.ReturnType.HasTypeDefinition -> return Some case.ReturnType.TypeDefinition - | SymbolPatterns.FSharpEntity (entity, _, _) -> return Some entity + | SymbolPatterns.FSharpEntity(entity, _, _) -> return Some entity | _ -> return None } @@ -520,8 +519,8 @@ let tryFindUnionDefinitionFromPos (codeGenService: ICodeGenerationService) pos d let! realTypeDefinition = match superficialTypeDefinition with - | Some (AbbreviatedType (TypeWithDefinition typeDef)) when typeDef.IsFSharpUnion -> Some typeDef - | Some (UnionType (_)) -> superficialTypeDefinition + | Some(AbbreviatedType(TypeWithDefinition typeDef)) when typeDef.IsFSharpUnion -> Some typeDef + | Some(UnionType(_)) -> superficialTypeDefinition | _ -> None return patMatchExpr, realTypeDefinition, insertionParams diff --git a/src/FsAutoComplete.Core/UntypedAstUtils.fs b/src/FsAutoComplete.Core/UntypedAstUtils.fs index e0d6f513f..33bd3c3a9 100644 --- a/src/FsAutoComplete.Core/UntypedAstUtils.fs +++ b/src/FsAutoComplete.Core/UntypedAstUtils.fs @@ -19,14 +19,14 @@ let internal longIdentToArray (longIdent: LongIdent) : Idents = /// An recursive pattern that collect all sequential expressions to avoid StackOverflowException let rec (|Sequentials|_|) = function - | SynExpr.Sequential (_, _, e, Sequentials es, _) -> Some(e :: es) - | SynExpr.Sequential (_, _, e1, e2, _) -> Some [ e1; e2 ] + | SynExpr.Sequential(_, _, e, Sequentials es, _) -> Some(e :: es) + | SynExpr.Sequential(_, _, e1, e2, _) -> Some [ e1; e2 ] | _ -> None let (|ConstructorPats|) = function | SynArgPats.Pats ps -> ps - | SynArgPats.NamePatPairs (xs, _) -> xs |> List.map (fun (_, _, pat) -> pat) + | SynArgPats.NamePatPairs(xs, _) -> xs |> List.map (fun (_, _, pat) -> pat) /// matches if the range contains the position let (|ContainsPos|_|) pos range = @@ -49,8 +49,8 @@ let (|AllAttrs|) (attrs: SynAttributes) = let (|AllSimplePats|) (pats: SynSimplePats) = let rec loop acc pat = match pat with - | SynSimplePats.SimplePats (pats, _) -> acc @ pats - | SynSimplePats.Typed (pats, _, _) -> loop acc pats + | SynSimplePats.SimplePats(pats, _) -> acc @ pats + | SynSimplePats.Typed(pats, _, _) -> loop acc pats loop [] pats @@ -69,10 +69,10 @@ let internal getRangesAtPosition input (r: Position) : Range list = - let rec walkImplFileInput (ParsedImplFileInput (modules = moduleOrNamespaceList)) = + let rec walkImplFileInput (ParsedImplFileInput(modules = moduleOrNamespaceList)) = List.iter walkSynModuleOrNamespace moduleOrNamespaceList - and walkSynModuleOrNamespace (SynModuleOrNamespace (_, _, _, decls, _, AllAttrs attrs, _, r)) = + and walkSynModuleOrNamespace (SynModuleOrNamespace(_, _, _, decls, _, AllAttrs attrs, _, r)) = addIfInside r List.iter walkAttribute attrs List.iter walkSynModuleDecl decls @@ -81,7 +81,7 @@ let internal getRangesAtPosition input (r: Position) : Range list = addIfInside attr.Range walkExpr attr.ArgExpr - and walkTyparDecl (SynTyparDecl (attributes = AllAttrs attrs; Item2 = typar)) = + and walkTyparDecl (SynTyparDecl(attributes = AllAttrs attrs; Item2 = typar)) = List.iter walkAttribute attrs walkTypar typar @@ -89,82 +89,82 @@ let internal getRangesAtPosition input (r: Position) : Range list = typars.TyparDecls |> List.iter walkTyparDecl typars.Constraints |> List.iter walkTypeConstraint - and walkSynValTyparDecls (SynValTyparDecls (typars, _)) = Option.iter walkTyparDecls typars + and walkSynValTyparDecls (SynValTyparDecls(typars, _)) = Option.iter walkTyparDecls typars and walkTypeConstraint = function - | SynTypeConstraint.WhereTyparIsValueType (t, r) - | SynTypeConstraint.WhereTyparIsReferenceType (t, r) - | SynTypeConstraint.WhereTyparIsUnmanaged (t, r) - | SynTypeConstraint.WhereTyparSupportsNull (t, r) - | SynTypeConstraint.WhereTyparIsComparable (t, r) - | SynTypeConstraint.WhereTyparIsEquatable (t, r) -> + | SynTypeConstraint.WhereTyparIsValueType(t, r) + | SynTypeConstraint.WhereTyparIsReferenceType(t, r) + | SynTypeConstraint.WhereTyparIsUnmanaged(t, r) + | SynTypeConstraint.WhereTyparSupportsNull(t, r) + | SynTypeConstraint.WhereTyparIsComparable(t, r) + | SynTypeConstraint.WhereTyparIsEquatable(t, r) -> addIfInside r walkTypar t - | SynTypeConstraint.WhereTyparDefaultsToType (t, ty, r) - | SynTypeConstraint.WhereTyparSubtypeOfType (t, ty, r) -> + | SynTypeConstraint.WhereTyparDefaultsToType(t, ty, r) + | SynTypeConstraint.WhereTyparSubtypeOfType(t, ty, r) -> addIfInside r walkTypar t walkType ty - | SynTypeConstraint.WhereTyparIsEnum (t, ts, r) - | SynTypeConstraint.WhereTyparIsDelegate (t, ts, r) -> + | SynTypeConstraint.WhereTyparIsEnum(t, ts, r) + | SynTypeConstraint.WhereTyparIsDelegate(t, ts, r) -> addIfInside r walkTypar t List.iter walkType ts - | SynTypeConstraint.WhereTyparSupportsMember (ts, sign, r) -> + | SynTypeConstraint.WhereTyparSupportsMember(ts, sign, r) -> addIfInside r List.iter walkType ts walkMemberSig sign and walkPat = function - | SynPat.Tuple (_, pats, r) - | SynPat.ArrayOrList (_, pats, r) - | SynPat.Ands (pats, r) -> + | SynPat.Tuple(_, pats, r) + | SynPat.ArrayOrList(_, pats, r) + | SynPat.Ands(pats, r) -> addIfInside r List.iter walkPat pats - | SynPat.Named (ident, _, _, r) -> addIfInside r - | SynPat.Typed (pat, t, r) -> + | SynPat.Named(ident, _, _, r) -> addIfInside r + | SynPat.Typed(pat, t, r) -> addIfInside r walkPat pat walkType t - | SynPat.Attrib (pat, AllAttrs attrs, r) -> + | SynPat.Attrib(pat, AllAttrs attrs, r) -> addIfInside r walkPat pat List.iter walkAttribute attrs - | SynPat.Or (pat1, pat2, r, _) -> + | SynPat.Or(pat1, pat2, r, _) -> addIfInside r List.iter walkPat [ pat1; pat2 ] - | SynPat.LongIdent (ident, _, _, typars, ConstructorPats pats, _, r) -> + | SynPat.LongIdent(ident, _, _, typars, ConstructorPats pats, _, r) -> addIfInside r Option.iter walkSynValTyparDecls typars List.iter walkPat pats - | SynPat.Paren (pat, r) -> + | SynPat.Paren(pat, r) -> addIfInside r walkPat pat - | SynPat.IsInst (t, r) -> + | SynPat.IsInst(t, r) -> addIfInside r walkType t - | SynPat.QuoteExpr (e, r) -> + | SynPat.QuoteExpr(e, r) -> addIfInside r walkExpr e - | SynPat.Const (_, r) -> addIfInside r - | SynPat.Wild (r) -> addIfInside r - | SynPat.Record (_, r) -> addIfInside r - | SynPat.Null (r) -> addIfInside r - | SynPat.OptionalVal (_, r) -> addIfInside r - | SynPat.DeprecatedCharRange (_, _, r) -> addIfInside r - | SynPat.InstanceMember (_, _, _, accessibility, r) -> addIfInside r - | SynPat.FromParseError (_, r) -> addIfInside r - | SynPat.As (lpat, rpat, r) -> + | SynPat.Const(_, r) -> addIfInside r + | SynPat.Wild(r) -> addIfInside r + | SynPat.Record(_, r) -> addIfInside r + | SynPat.Null(r) -> addIfInside r + | SynPat.OptionalVal(_, r) -> addIfInside r + | SynPat.DeprecatedCharRange(_, _, r) -> addIfInside r + | SynPat.InstanceMember(_, _, _, accessibility, r) -> addIfInside r + | SynPat.FromParseError(_, r) -> addIfInside r + | SynPat.As(lpat, rpat, r) -> addIfInside r walkPat lpat walkPat rpat - and walkTypar (SynTypar (_, _, _)) = () + and walkTypar (SynTypar(_, _, _)) = () and walkBinding - (SynBinding (attributes = AllAttrs attrs; headPat = pat; returnInfo = returnInfo; expr = e; range = r)) + (SynBinding(attributes = AllAttrs attrs; headPat = pat; returnInfo = returnInfo; expr = e; range = r)) = addIfInside r List.iter walkAttribute attrs @@ -172,53 +172,53 @@ let internal getRangesAtPosition input (r: Position) : Range list = walkExpr e returnInfo - |> Option.iter (fun (SynBindingReturnInfo (t, r, _)) -> + |> Option.iter (fun (SynBindingReturnInfo(t, r, _)) -> addIfInside r walkType t) - and walkInterfaceImpl (SynInterfaceImpl (bindings = bindings; range = r)) = + and walkInterfaceImpl (SynInterfaceImpl(bindings = bindings; range = r)) = addIfInside r List.iter walkBinding bindings and walkType = function - | SynType.Array (_, t, r) - | SynType.HashConstraint (t, r) - | SynType.MeasurePower (t, _, r) -> + | SynType.Array(_, t, r) + | SynType.HashConstraint(t, r) + | SynType.MeasurePower(t, _, r) -> addIfInside r walkType t - | SynType.Fun (t1, t2, r) - | SynType.MeasureDivide (t1, t2, r) -> + | SynType.Fun(t1, t2, r) + | SynType.MeasureDivide(t1, t2, r) -> addIfInside r walkType t1 walkType t2 - | SynType.App (ty, _, types, _, _, _, r) -> + | SynType.App(ty, _, types, _, _, _, r) -> addIfInside r walkType ty List.iter walkType types - | SynType.LongIdentApp (_, _, _, types, _, _, r) -> + | SynType.LongIdentApp(_, _, _, types, _, _, r) -> addIfInside r List.iter walkType types - | SynType.Tuple (_, ts, r) -> + | SynType.Tuple(_, ts, r) -> addIfInside r ts |> List.iter (fun (_, t) -> walkType t) - | SynType.WithGlobalConstraints (t, typeConstraints, r) -> + | SynType.WithGlobalConstraints(t, typeConstraints, r) -> addIfInside r walkType t List.iter walkTypeConstraint typeConstraints - | SynType.LongIdent (longDotId) -> () - | SynType.AnonRecd (isStruct, typeNames, r) -> addIfInside r - | SynType.Var (genericName, r) -> addIfInside r - | SynType.Anon (r) -> addIfInside r - | SynType.StaticConstant (constant, r) -> addIfInside r - | SynType.StaticConstantExpr (expr, r) -> addIfInside r - | SynType.StaticConstantNamed (expr, _, r) -> addIfInside r - | SynType.Paren (innerType, r) -> + | SynType.LongIdent(longDotId) -> () + | SynType.AnonRecd(isStruct, typeNames, r) -> addIfInside r + | SynType.Var(genericName, r) -> addIfInside r + | SynType.Anon(r) -> addIfInside r + | SynType.StaticConstant(constant, r) -> addIfInside r + | SynType.StaticConstantExpr(expr, r) -> addIfInside r + | SynType.StaticConstantNamed(expr, _, r) -> addIfInside r + | SynType.Paren(innerType, r) -> addIfInside r walkType innerType - and walkClause (SynMatchClause (pat, e1, e2, r, _, _)) = + and walkClause (SynMatchClause(pat, e1, e2, r, _, _)) = addIfInside r walkPat pat walkExpr e2 @@ -226,74 +226,74 @@ let internal getRangesAtPosition input (r: Position) : Range list = and walkSimplePats = function - | SynSimplePats.SimplePats (pats, r) -> + | SynSimplePats.SimplePats(pats, r) -> addIfInside r List.iter walkSimplePat pats - | SynSimplePats.Typed (pats, ty, r) -> + | SynSimplePats.Typed(pats, ty, r) -> addIfInside r walkSimplePats pats walkType ty and walkInterpolatedStringPart = function - | SynInterpolatedStringPart.FillExpr (expr, ident) -> + | SynInterpolatedStringPart.FillExpr(expr, ident) -> ident |> Option.iter (fun ident -> addIfInside ident.idRange) walkExpr expr - | SynInterpolatedStringPart.String (s, r) -> addIfInside r + | SynInterpolatedStringPart.String(s, r) -> addIfInside r and walkExpr = function - | SynExpr.Typed (e, _, r) -> + | SynExpr.Typed(e, _, r) -> addIfInside r walkExpr e - | SynExpr.Paren (e, _, _, r) - | SynExpr.Quote (_, _, e, _, r) - | SynExpr.InferredUpcast (e, r) - | SynExpr.InferredDowncast (e, r) - | SynExpr.AddressOf (_, e, _, r) - | SynExpr.DoBang (e, r) - | SynExpr.YieldOrReturn (_, e, r) - | SynExpr.ArrayOrListComputed (_, e, r) - | SynExpr.ComputationExpr (_, e, r) - | SynExpr.Do (e, r) - | SynExpr.Assert (e, r) - | SynExpr.Lazy (e, r) - | SynExpr.YieldOrReturnFrom (_, e, r) -> + | SynExpr.Paren(e, _, _, r) + | SynExpr.Quote(_, _, e, _, r) + | SynExpr.InferredUpcast(e, r) + | SynExpr.InferredDowncast(e, r) + | SynExpr.AddressOf(_, e, _, r) + | SynExpr.DoBang(e, r) + | SynExpr.YieldOrReturn(_, e, r) + | SynExpr.ArrayOrListComputed(_, e, r) + | SynExpr.ComputationExpr(_, e, r) + | SynExpr.Do(e, r) + | SynExpr.Assert(e, r) + | SynExpr.Lazy(e, r) + | SynExpr.YieldOrReturnFrom(_, e, r) -> addIfInside r walkExpr e - | SynExpr.SequentialOrImplicitYield (_, e1, e2, ifNotE, r) -> + | SynExpr.SequentialOrImplicitYield(_, e1, e2, ifNotE, r) -> addIfInside r walkExpr e1 walkExpr e2 walkExpr ifNotE - | SynExpr.Lambda (args = pats; body = e; range = r) -> + | SynExpr.Lambda(args = pats; body = e; range = r) -> addIfInside r walkSimplePats pats walkExpr e - | SynExpr.New (_, t, e, r) - | SynExpr.TypeTest (e, t, r) - | SynExpr.Upcast (e, t, r) - | SynExpr.Downcast (e, t, r) -> + | SynExpr.New(_, t, e, r) + | SynExpr.TypeTest(e, t, r) + | SynExpr.Upcast(e, t, r) + | SynExpr.Downcast(e, t, r) -> addIfInside r walkExpr e walkType t - | SynExpr.Tuple (_, es, _, _) + | SynExpr.Tuple(_, es, _, _) | Sequentials es -> List.iter walkExpr es //TODO?? - | SynExpr.ArrayOrList (_, es, r) -> + | SynExpr.ArrayOrList(_, es, r) -> addIfInside r List.iter walkExpr es - | SynExpr.App (_, _, e1, e2, r) - | SynExpr.TryFinally (e1, e2, r, _, _, _) - | SynExpr.While (_, e1, e2, r) -> + | SynExpr.App(_, _, e1, e2, r) + | SynExpr.TryFinally(e1, e2, r, _, _, _) + | SynExpr.While(_, e1, e2, r) -> addIfInside r List.iter walkExpr [ e1; e2 ] - | SynExpr.Record (_, _, fields, r) -> + | SynExpr.Record(_, _, fields, r) -> addIfInside r fields - |> List.iter (fun (SynExprRecordField (fieldName = (ident, _); expr = e)) -> e |> Option.iter walkExpr) - | SynExpr.ObjExpr (ty, argOpt, _, bindings, _, ifaces, _, r) -> + |> List.iter (fun (SynExprRecordField(fieldName = (ident, _); expr = e)) -> e |> Option.iter walkExpr) + | SynExpr.ObjExpr(ty, argOpt, _, bindings, _, ifaces, _, r) -> addIfInside r argOpt |> Option.iter (fun (e, ident) -> walkExpr e) @@ -301,128 +301,128 @@ let internal getRangesAtPosition input (r: Position) : Range list = walkType ty List.iter walkBinding bindings List.iter walkInterfaceImpl ifaces - | SynExpr.For (identBody = e1; toBody = e2; doBody = e3; range = r) -> + | SynExpr.For(identBody = e1; toBody = e2; doBody = e3; range = r) -> addIfInside r List.iter walkExpr [ e1; e2; e3 ] - | SynExpr.ForEach (_, _, _, _, pat, e1, e2, r) -> + | SynExpr.ForEach(_, _, _, _, pat, e1, e2, r) -> addIfInside r walkPat pat List.iter walkExpr [ e1; e2 ] - | SynExpr.MatchLambda (_, _, synMatchClauseList, _, r) -> + | SynExpr.MatchLambda(_, _, synMatchClauseList, _, r) -> addIfInside r List.iter walkClause synMatchClauseList - | SynExpr.Match (_, _, e, _, synMatchClauseList, r) -> + | SynExpr.Match(_, _, e, _, synMatchClauseList, r) -> addIfInside r walkExpr e List.iter walkClause synMatchClauseList - | SynExpr.TypeApp (e, _, tys, _, _, tr, r) -> + | SynExpr.TypeApp(e, _, tys, _, _, tr, r) -> addIfInside tr addIfInside r List.iter walkType tys walkExpr e - | SynExpr.LetOrUse (bindings = bindings; body = e; range = r) -> + | SynExpr.LetOrUse(bindings = bindings; body = e; range = r) -> addIfInside r List.iter walkBinding bindings walkExpr e - | SynExpr.TryWith (tryExpr = e; withCases = clauses; range = r) -> + | SynExpr.TryWith(tryExpr = e; withCases = clauses; range = r) -> addIfInside r List.iter walkClause clauses walkExpr e - | SynExpr.IfThenElse (ifExpr = e1; thenExpr = e2; elseExpr = e3; range = r) -> + | SynExpr.IfThenElse(ifExpr = e1; thenExpr = e2; elseExpr = e3; range = r) -> addIfInside r List.iter walkExpr [ e1; e2 ] e3 |> Option.iter walkExpr - | SynExpr.LongIdentSet (ident, e, r) - | SynExpr.DotGet (e, _, ident, r) -> + | SynExpr.LongIdentSet(ident, e, r) + | SynExpr.DotGet(e, _, ident, r) -> addIfInside r walkExpr e - | SynExpr.DotSet (e1, idents, e2, r) -> + | SynExpr.DotSet(e1, idents, e2, r) -> addIfInside r walkExpr e1 walkExpr e2 - | SynExpr.DotIndexedGet (e, args, _, r) -> + | SynExpr.DotIndexedGet(e, args, _, r) -> addIfInside r walkExpr e walkExpr args - | SynExpr.DotIndexedSet (e1, args, e2, _, _, r) -> + | SynExpr.DotIndexedSet(e1, args, e2, _, _, r) -> addIfInside r walkExpr e1 walkExpr args walkExpr e2 - | SynExpr.NamedIndexedPropertySet (ident, e1, e2, r) -> + | SynExpr.NamedIndexedPropertySet(ident, e1, e2, r) -> addIfInside r List.iter walkExpr [ e1; e2 ] - | SynExpr.DotNamedIndexedPropertySet (e1, ident, e2, e3, r) -> + | SynExpr.DotNamedIndexedPropertySet(e1, ident, e2, e3, r) -> addIfInside r List.iter walkExpr [ e1; e2; e3 ] - | SynExpr.JoinIn (e1, _, e2, r) -> + | SynExpr.JoinIn(e1, _, e2, r) -> addIfInside r List.iter walkExpr [ e1; e2 ] - | SynExpr.LetOrUseBang (pat = pat; rhs = e1; andBangs = ands; body = e2; range = r) -> + | SynExpr.LetOrUseBang(pat = pat; rhs = e1; andBangs = ands; body = e2; range = r) -> addIfInside r walkPat pat walkExpr e1 - for (SynExprAndBang (pat = pat; body = body; range = r)) in ands do + for (SynExprAndBang(pat = pat; body = body; range = r)) in ands do addIfInside r walkPat pat walkExpr body walkExpr e2 - | SynExpr.TraitCall (ts, sign, e, r) -> + | SynExpr.TraitCall(ts, sign, e, r) -> addIfInside r List.iter walkTypar ts walkMemberSig sign walkExpr e - | SynExpr.Const (SynConst.Measure (_, _, m), r) -> + | SynExpr.Const(SynConst.Measure(_, _, m), r) -> addIfInside r walkMeasure m - | SynExpr.Const (_, r) -> addIfInside r - | SynExpr.AnonRecd (isStruct, copyInfo, recordFields, r) -> addIfInside r - | SynExpr.Sequential (seqPoint, isTrueSeq, expr1, expr2, r) -> () - | SynExpr.Ident (_) -> () - | SynExpr.LongIdent (isOptional, longDotId, altNameRefCell, r) -> addIfInside r - | SynExpr.Set (_, _, r) -> addIfInside r - | SynExpr.Null (r) -> addIfInside r - | SynExpr.ImplicitZero (r) -> addIfInside r - | SynExpr.MatchBang (range = r) -> addIfInside r - | SynExpr.LibraryOnlyILAssembly (_, _, _, _, r) -> addIfInside r - | SynExpr.LibraryOnlyStaticOptimization (_, _, _, r) -> addIfInside r - | SynExpr.LibraryOnlyUnionCaseFieldGet (expr, longId, _, r) -> addIfInside r - | SynExpr.LibraryOnlyUnionCaseFieldSet (_, longId, _, _, r) -> addIfInside r - | SynExpr.ArbitraryAfterError (debugStr, r) -> addIfInside r - | SynExpr.FromParseError (expr, r) -> addIfInside r - | SynExpr.DiscardAfterMissingQualificationAfterDot (_, r) -> addIfInside r - | SynExpr.Fixed (expr, r) -> addIfInside r - | SynExpr.InterpolatedString (parts, kind, r) -> + | SynExpr.Const(_, r) -> addIfInside r + | SynExpr.AnonRecd(isStruct, copyInfo, recordFields, r) -> addIfInside r + | SynExpr.Sequential(seqPoint, isTrueSeq, expr1, expr2, r) -> () + | SynExpr.Ident(_) -> () + | SynExpr.LongIdent(isOptional, longDotId, altNameRefCell, r) -> addIfInside r + | SynExpr.Set(_, _, r) -> addIfInside r + | SynExpr.Null(r) -> addIfInside r + | SynExpr.ImplicitZero(r) -> addIfInside r + | SynExpr.MatchBang(range = r) -> addIfInside r + | SynExpr.LibraryOnlyILAssembly(_, _, _, _, r) -> addIfInside r + | SynExpr.LibraryOnlyStaticOptimization(_, _, _, r) -> addIfInside r + | SynExpr.LibraryOnlyUnionCaseFieldGet(expr, longId, _, r) -> addIfInside r + | SynExpr.LibraryOnlyUnionCaseFieldSet(_, longId, _, _, r) -> addIfInside r + | SynExpr.ArbitraryAfterError(debugStr, r) -> addIfInside r + | SynExpr.FromParseError(expr, r) -> addIfInside r + | SynExpr.DiscardAfterMissingQualificationAfterDot(_, r) -> addIfInside r + | SynExpr.Fixed(expr, r) -> addIfInside r + | SynExpr.InterpolatedString(parts, kind, r) -> addIfInside r for part in parts do walkInterpolatedStringPart part - | SynExpr.IndexFromEnd (itemExpr, r) -> + | SynExpr.IndexFromEnd(itemExpr, r) -> addIfInside r walkExpr itemExpr - | SynExpr.IndexRange (e1, _, e2, _, _, r) -> + | SynExpr.IndexRange(e1, _, e2, _, _, r) -> addIfInside r Option.iter walkExpr e1 Option.iter walkExpr e2 - | SynExpr.DebugPoint (innerExpr = expr) -> walkExpr expr + | SynExpr.DebugPoint(innerExpr = expr) -> walkExpr expr and walkMeasure = function - | SynMeasure.Product (m1, m2, r) - | SynMeasure.Divide (m1, m2, r) -> + | SynMeasure.Product(m1, m2, r) + | SynMeasure.Divide(m1, m2, r) -> addIfInside r walkMeasure m1 walkMeasure m2 - | SynMeasure.Named (longIdent, r) -> addIfInside r - | SynMeasure.Seq (ms, r) -> + | SynMeasure.Named(longIdent, r) -> addIfInside r + | SynMeasure.Seq(ms, r) -> addIfInside r List.iter walkMeasure ms - | SynMeasure.Power (m, _, r) -> + | SynMeasure.Power(m, _, r) -> addIfInside r walkMeasure m - | SynMeasure.Var (ty, r) -> + | SynMeasure.Var(ty, r) -> addIfInside r walkTypar ty | SynMeasure.One @@ -430,24 +430,24 @@ let internal getRangesAtPosition input (r: Position) : Range list = and walkSimplePat = function - | SynSimplePat.Attrib (pat, AllAttrs attrs, r) -> + | SynSimplePat.Attrib(pat, AllAttrs attrs, r) -> addIfInside r walkSimplePat pat List.iter walkAttribute attrs - | SynSimplePat.Typed (pat, t, r) -> + | SynSimplePat.Typed(pat, t, r) -> addIfInside r walkSimplePat pat walkType t - | SynSimplePat.Id (ident, altNameRefCell, isCompilerGenerated, isThisVar, isOptArg, r) -> addIfInside r + | SynSimplePat.Id(ident, altNameRefCell, isCompilerGenerated, isThisVar, isOptArg, r) -> addIfInside r - and walkField (SynField (attributes = AllAttrs attrs; fieldType = t; range = r)) = + and walkField (SynField(attributes = AllAttrs attrs; fieldType = t; range = r)) = addIfInside r List.iter walkAttribute attrs walkType t and walkValSig - (SynValSig (attributes = AllAttrs attrs; synType = t; arity = SynValInfo (argInfos, argInfo); range = r)) + (SynValSig(attributes = AllAttrs attrs; synType = t; arity = SynValInfo(argInfos, argInfo); range = r)) = addIfInside r List.iter walkAttribute attrs @@ -459,24 +459,24 @@ let internal getRangesAtPosition input (r: Position) : Range list = and walkMemberSig = function - | SynMemberSig.Inherit (t, r) - | SynMemberSig.Interface (t, r) -> + | SynMemberSig.Inherit(t, r) + | SynMemberSig.Interface(t, r) -> addIfInside r walkType t - | SynMemberSig.Member (vs, _, r) -> + | SynMemberSig.Member(vs, _, r) -> addIfInside r walkValSig vs - | SynMemberSig.ValField (f, r) -> + | SynMemberSig.ValField(f, r) -> addIfInside r walkField f - | SynMemberSig.NestedType (SynTypeDefnSig (typeInfo = info; typeRepr = repr; members = memberSigs), r) -> + | SynMemberSig.NestedType(SynTypeDefnSig(typeInfo = info; typeRepr = repr; members = memberSigs), r) -> addIfInside r let isTypeExtensionOrAlias = match repr with - | SynTypeDefnSigRepr.Simple (SynTypeDefnSimpleRepr.TypeAbbrev _, _) - | SynTypeDefnSigRepr.ObjectModel (SynTypeDefnKind.Abbrev, _, _) - | SynTypeDefnSigRepr.ObjectModel (SynTypeDefnKind.Augmentation _, _, _) -> true + | SynTypeDefnSigRepr.Simple(SynTypeDefnSimpleRepr.TypeAbbrev _, _) + | SynTypeDefnSigRepr.ObjectModel(SynTypeDefnKind.Abbrev, _, _) + | SynTypeDefnSigRepr.ObjectModel(SynTypeDefnKind.Augmentation _, _, _) -> true | _ -> false walkComponentInfo isTypeExtensionOrAlias info @@ -485,83 +485,80 @@ let internal getRangesAtPosition input (r: Position) : Range list = and walkMember = function - | SynMemberDefn.AbstractSlot (valSig, _, r) -> + | SynMemberDefn.AbstractSlot(valSig, _, r) -> addIfInside r walkValSig valSig - | SynMemberDefn.Member (binding, r) -> + | SynMemberDefn.Member(binding, r) -> addIfInside r walkBinding binding - | SynMemberDefn.ImplicitCtor (_, AllAttrs attrs, AllSimplePats pats, _, _, r) -> + | SynMemberDefn.ImplicitCtor(_, AllAttrs attrs, AllSimplePats pats, _, _, r) -> addIfInside r List.iter walkAttribute attrs List.iter walkSimplePat pats - | SynMemberDefn.ImplicitInherit (t, e, _, r) -> + | SynMemberDefn.ImplicitInherit(t, e, _, r) -> addIfInside r walkType t walkExpr e - | SynMemberDefn.LetBindings (bindings, _, _, r) -> + | SynMemberDefn.LetBindings(bindings, _, _, r) -> addIfInside r List.iter walkBinding bindings - | SynMemberDefn.Interface (t, _, members, r) -> + | SynMemberDefn.Interface(t, _, members, r) -> addIfInside r walkType t members |> Option.iter (List.iter walkMember) - | SynMemberDefn.Inherit (t, _, r) -> + | SynMemberDefn.Inherit(t, _, r) -> addIfInside r walkType t - | SynMemberDefn.ValField (field, r) -> + | SynMemberDefn.ValField(field, r) -> addIfInside r walkField field - | SynMemberDefn.NestedType (tdef, _, r) -> + | SynMemberDefn.NestedType(tdef, _, r) -> addIfInside r walkTypeDefn tdef - | SynMemberDefn.AutoProperty (attributes = AllAttrs attrs; typeOpt = t; synExpr = e; range = r) -> + | SynMemberDefn.AutoProperty(attributes = AllAttrs attrs; typeOpt = t; synExpr = e; range = r) -> addIfInside r List.iter walkAttribute attrs Option.iter walkType t walkExpr e - | SynMemberDefn.Open (longId, r) -> addIfInside r + | SynMemberDefn.Open(longId, r) -> addIfInside r - and walkEnumCase (SynEnumCase (attributes = AllAttrs attrs; range = r)) = + and walkEnumCase (SynEnumCase(attributes = AllAttrs attrs; range = r)) = addIfInside r List.iter walkAttribute attrs and walkUnionCaseType = function | SynUnionCaseKind.Fields fields -> List.iter walkField fields - | SynUnionCaseKind.FullType (t, _) -> walkType t + | SynUnionCaseKind.FullType(t, _) -> walkType t - and walkUnionCase (SynUnionCase (attributes = AllAttrs attrs; caseType = t; range = r)) = + and walkUnionCase (SynUnionCase(attributes = AllAttrs attrs; caseType = t; range = r)) = addIfInside r List.iter walkAttribute attrs walkUnionCaseType t and walkTypeDefnSimple = function - | SynTypeDefnSimpleRepr.Enum (cases, r) -> + | SynTypeDefnSimpleRepr.Enum(cases, r) -> addIfInside r List.iter walkEnumCase cases - | SynTypeDefnSimpleRepr.Union (_, cases, r) -> + | SynTypeDefnSimpleRepr.Union(_, cases, r) -> addIfInside r List.iter walkUnionCase cases - | SynTypeDefnSimpleRepr.Record (_, fields, r) -> + | SynTypeDefnSimpleRepr.Record(_, fields, r) -> addIfInside r List.iter walkField fields - | SynTypeDefnSimpleRepr.TypeAbbrev (_, t, r) -> + | SynTypeDefnSimpleRepr.TypeAbbrev(_, t, r) -> addIfInside r walkType t - | SynTypeDefnSimpleRepr.General (_, _, _, _, _, _, _, r) -> addIfInside r - | SynTypeDefnSimpleRepr.LibraryOnlyILAssembly (_, r) -> addIfInside r - | SynTypeDefnSimpleRepr.None (r) -> addIfInside r - | SynTypeDefnSimpleRepr.Exception (_) -> () + | SynTypeDefnSimpleRepr.General(_, _, _, _, _, _, _, r) -> addIfInside r + | SynTypeDefnSimpleRepr.LibraryOnlyILAssembly(_, r) -> addIfInside r + | SynTypeDefnSimpleRepr.None(r) -> addIfInside r + | SynTypeDefnSimpleRepr.Exception(_) -> () and walkComponentInfo isTypeExtensionOrAlias - (SynComponentInfo (attributes = AllAttrs attrs - typeParams = typars - constraints = constraints - longId = longIdent - range = r)) + (SynComponentInfo( + attributes = AllAttrs attrs; typeParams = typars; constraints = constraints; longId = longIdent; range = r)) = addIfInside r List.iter walkAttribute attrs @@ -570,28 +567,28 @@ let internal getRangesAtPosition input (r: Position) : Range list = and walkTypeDefnRepr = function - | SynTypeDefnRepr.ObjectModel (_, defns, r) -> + | SynTypeDefnRepr.ObjectModel(_, defns, r) -> addIfInside r List.iter walkMember defns - | SynTypeDefnRepr.Simple (defn, r) -> + | SynTypeDefnRepr.Simple(defn, r) -> addIfInside r walkTypeDefnSimple defn | SynTypeDefnRepr.Exception _ -> () and walkTypeDefnSigRepr = function - | SynTypeDefnSigRepr.ObjectModel (_, defns, _) -> List.iter walkMemberSig defns - | SynTypeDefnSigRepr.Simple (defn, _) -> walkTypeDefnSimple defn + | SynTypeDefnSigRepr.ObjectModel(_, defns, _) -> List.iter walkMemberSig defns + | SynTypeDefnSigRepr.Simple(defn, _) -> walkTypeDefnSimple defn | SynTypeDefnSigRepr.Exception _ -> () - and walkTypeDefn (SynTypeDefn (info, repr, members, implicitCtor, r, _)) = + and walkTypeDefn (SynTypeDefn(info, repr, members, implicitCtor, r, _)) = addIfInside r let isTypeExtensionOrAlias = match repr with - | SynTypeDefnRepr.ObjectModel (SynTypeDefnKind.Augmentation _, _, _) - | SynTypeDefnRepr.ObjectModel (SynTypeDefnKind.Abbrev, _, _) - | SynTypeDefnRepr.Simple (SynTypeDefnSimpleRepr.TypeAbbrev _, _) -> true + | SynTypeDefnRepr.ObjectModel(SynTypeDefnKind.Augmentation _, _, _) + | SynTypeDefnRepr.ObjectModel(SynTypeDefnKind.Abbrev, _, _) + | SynTypeDefnRepr.Simple(SynTypeDefnSimpleRepr.TypeAbbrev _, _) -> true | _ -> false walkComponentInfo isTypeExtensionOrAlias info @@ -602,26 +599,26 @@ let internal getRangesAtPosition input (r: Position) : Range list = and walkSynModuleDecl (decl: SynModuleDecl) = match decl with | SynModuleDecl.NamespaceFragment fragment -> walkSynModuleOrNamespace fragment - | SynModuleDecl.NestedModule (info, _, modules, _, r, _) -> + | SynModuleDecl.NestedModule(info, _, modules, _, r, _) -> addIfInside r walkComponentInfo false info List.iter walkSynModuleDecl modules - | SynModuleDecl.Let (_, bindings, r) -> + | SynModuleDecl.Let(_, bindings, r) -> addIfInside r List.iter walkBinding bindings - | SynModuleDecl.Expr (expr, r) -> + | SynModuleDecl.Expr(expr, r) -> addIfInside r walkExpr expr - | SynModuleDecl.Types (types, r) -> + | SynModuleDecl.Types(types, r) -> addIfInside r List.iter walkTypeDefn types - | SynModuleDecl.Attributes (attributes = AllAttrs attrs; range = r) -> + | SynModuleDecl.Attributes(attributes = AllAttrs attrs; range = r) -> addIfInside r List.iter walkAttribute attrs - | SynModuleDecl.ModuleAbbrev (ident, longId, r) -> addIfInside r - | SynModuleDecl.Exception (_, r) -> addIfInside r - | SynModuleDecl.Open (longDotId, r) -> addIfInside r - | SynModuleDecl.HashDirective (_, r) -> addIfInside r + | SynModuleDecl.ModuleAbbrev(ident, longId, r) -> addIfInside r + | SynModuleDecl.Exception(_, r) -> addIfInside r + | SynModuleDecl.Open(longDotId, r) -> addIfInside r + | SynModuleDecl.HashDirective(_, r) -> addIfInside r match input with | ParsedInput.ImplFile input -> walkImplFileInput input @@ -644,14 +641,14 @@ module Completion = member x.VisitExpr(path, traverseExpr, defaultTraverse, expr) : Context option = if Range.rangeContainsPos expr.Range pos then match expr with - | SynExpr.Const (SynConst.String _, _) -> Some Context.StringLiteral - | SynExpr.InterpolatedString (parts, _, _) -> + | SynExpr.Const(SynConst.String _, _) -> Some Context.StringLiteral + | SynExpr.InterpolatedString(parts, _, _) -> parts |> List.tryPick (function - | SynInterpolatedStringPart.String (s, m) when Range.rangeContainsPos m pos -> + | SynInterpolatedStringPart.String(s, m) when Range.rangeContainsPos m pos -> Some Context.StringLiteral | SynInterpolatedStringPart.String _ -> None - | SynInterpolatedStringPart.FillExpr (e, _) when Range.rangeContainsPos e.Range pos -> + | SynInterpolatedStringPart.FillExpr(e, _) when Range.rangeContainsPos e.Range pos -> defaultTraverse e // gotta dive into the expr to see if we're in a literal inside the expr | SynInterpolatedStringPart.FillExpr _ -> None) | _ -> defaultTraverse expr diff --git a/src/FsAutoComplete.Core/Utils.fs b/src/FsAutoComplete.Core/Utils.fs index 005081fa0..a4e8e8eca 100644 --- a/src/FsAutoComplete.Core/Utils.fs +++ b/src/FsAutoComplete.Core/Utils.fs @@ -16,7 +16,7 @@ module Map = let merge (first: Map<'a, 'b>) (second: Map<'a, 'b>) = let mutable result = first - for (KeyValue (key, value)) in second do + for (KeyValue(key, value)) in second do result <- Map.add key value result result @@ -25,7 +25,7 @@ module Map = let combineTakeFirst (first: Map<_, _>) (second: Map<_, _>) = let mutable result = first - for (KeyValue (key, value)) in second do + for (KeyValue(key, value)) in second do if result.ContainsKey key then () else @@ -35,7 +35,7 @@ module Map = let values (m: Map<_, _>) = seq { - for (KeyValue (_, value)) in m do + for (KeyValue(_, value)) in m do yield value } @@ -145,7 +145,8 @@ let projectOptionsToParseOptions (checkOptions: FSharpProjectOptions) = | [||] -> checkOptions.OtherOptions |> Array.where (isFileWithFSharp) | x -> x - { FSharpParsingOptions.Default with SourceFiles = files } + { FSharpParsingOptions.Default with + SourceFiles = files } [] module Option = @@ -254,7 +255,7 @@ type MaybeBuilder() = member inline __.Combine(r1, r2: 'T option) : 'T option = match r1 with | None -> None - | Some () -> r2 + | Some() -> r2 // M<'T> * ('T -> M<'U>) -> M<'U> [] @@ -310,7 +311,7 @@ type AsyncMaybeBuilder() = match r1' with | None -> return None - | Some () -> return! r2 + | Some() -> return! r2 } [] @@ -723,7 +724,8 @@ module Version = let private informationalVersion () = let assemblies = - typeof.Assembly.GetCustomAttributes (typeof, true) + typeof.Assembly + .GetCustomAttributes(typeof, true) match assemblies with | [| x |] -> @@ -751,21 +753,20 @@ module Version = type Debounce<'a>(timeout, fn) as x = let mailbox = - MailboxProcessor<'a>.Start - (fun agent -> - let rec loop ida idb arg = - async { - let! r = agent.TryReceive(x.Timeout) - - match r with - | Some arg -> return! loop ida (idb + 1) (Some arg) - | None when ida <> idb -> - do! fn arg.Value - return! loop 0 0 None - | None -> return! loop 0 0 arg - } - - loop 0 0 None) + MailboxProcessor<'a>.Start(fun agent -> + let rec loop ida idb arg = + async { + let! r = agent.TryReceive(x.Timeout) + + match r with + | Some arg -> return! loop ida (idb + 1) (Some arg) + | None when ida <> idb -> + do! fn arg.Value + return! loop 0 0 None + | None -> return! loop 0 0 arg + } + + loop 0 0 None) /// Calls the function, after debouncing has been applied. member _.Bounce(arg) = mailbox.Post(arg) diff --git a/src/FsAutoComplete.Core/Workaround/ServiceParseTreeWalk.fs b/src/FsAutoComplete.Core/Workaround/ServiceParseTreeWalk.fs index 28ee177dc..5ebe1ed24 100644 --- a/src/FsAutoComplete.Core/Workaround/ServiceParseTreeWalk.fs +++ b/src/FsAutoComplete.Core/Workaround/ServiceParseTreeWalk.fs @@ -38,13 +38,13 @@ let unionBindingAndMembers (bindings: SynBinding list) (members: SynMemberDefn l yield! List.choose (function - | SynMemberDefn.Member (b, _) -> Some b + | SynMemberDefn.Member(b, _) -> Some b | _ -> None) members ] let rec private stripParenTypes synType = match synType with - | SynType.Paren (innerType, _) -> stripParenTypes innerType + | SynType.Paren(innerType, _) -> stripParenTypes innerType | _ -> synType let private (|StripParenTypes|) synType = stripParenTypes synType @@ -337,34 +337,34 @@ module SyntaxTraversal = let path = SyntaxNode.SynModule m :: origPath match m with - | SynModuleDecl.ModuleAbbrev (_ident, _longIdent, _range) -> None - | SynModuleDecl.NestedModule (decls = synModuleDecls) -> + | SynModuleDecl.ModuleAbbrev(_ident, _longIdent, _range) -> None + | SynModuleDecl.NestedModule(decls = synModuleDecls) -> synModuleDecls |> List.map (fun x -> dive x x.Range (traverseSynModuleDecl path)) |> pick decl - | SynModuleDecl.Let (isRecursive, synBindingList, range) -> + | SynModuleDecl.Let(isRecursive, synBindingList, range) -> match visitor.VisitLetOrUse(path, isRecursive, traverseSynBinding path, synBindingList, range) with | Some x -> Some x | None -> synBindingList |> List.map (fun x -> dive x x.RangeOfBindingWithRhs (traverseSynBinding path)) |> pick decl - | SynModuleDecl.Expr (synExpr, _range) -> traverseSynExpr path synExpr - | SynModuleDecl.Types (synTypeDefnList, _range) -> + | SynModuleDecl.Expr(synExpr, _range) -> traverseSynExpr path synExpr + | SynModuleDecl.Types(synTypeDefnList, _range) -> synTypeDefnList |> List.map (fun x -> dive x x.Range (traverseSynTypeDefn path)) |> pick decl - | SynModuleDecl.Exception (_synExceptionDefn, _range) -> None - | SynModuleDecl.Open (_target, _range) -> None - | SynModuleDecl.Attributes (_synAttributes, _range) -> None - | SynModuleDecl.HashDirective (parsedHashDirective, range) -> + | SynModuleDecl.Exception(_synExceptionDefn, _range) -> None + | SynModuleDecl.Open(_target, _range) -> None + | SynModuleDecl.Attributes(_synAttributes, _range) -> None + | SynModuleDecl.HashDirective(parsedHashDirective, range) -> visitor.VisitHashDirective(path, parsedHashDirective, range) - | SynModuleDecl.NamespaceFragment (synModuleOrNamespace) -> + | SynModuleDecl.NamespaceFragment(synModuleOrNamespace) -> traverseSynModuleOrNamespace path synModuleOrNamespace visitor.VisitModuleDecl(origPath, defaultTraverse, decl) - and traverseSynModuleOrNamespace origPath (SynModuleOrNamespace (decls = synModuleDecls; range = range) as mors) = + and traverseSynModuleOrNamespace origPath (SynModuleOrNamespace(decls = synModuleDecls; range = range) as mors) = match visitor.VisitModuleOrNamespace(origPath, mors) with | Some x -> Some x | None -> @@ -385,34 +385,34 @@ module SyntaxTraversal = match e with - | SynExpr.Paren (synExpr, _, _, _parenRange) -> traverseSynExpr synExpr + | SynExpr.Paren(synExpr, _, _, _parenRange) -> traverseSynExpr synExpr - | SynExpr.Quote (_synExpr, _, synExpr2, _, _range) -> + | SynExpr.Quote(_synExpr, _, synExpr2, _, _range) -> [ //dive synExpr synExpr.Range traverseSynExpr // TODO, what is this? dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.Const (_synConst, _range) -> None + | SynExpr.Const(_synConst, _range) -> None - | SynExpr.InterpolatedString (parts, _, _) -> + | SynExpr.InterpolatedString(parts, _, _) -> [ for part in parts do match part with | SynInterpolatedStringPart.String _ -> () - | SynInterpolatedStringPart.FillExpr (fillExpr, _) -> yield dive fillExpr fillExpr.Range traverseSynExpr ] + | SynInterpolatedStringPart.FillExpr(fillExpr, _) -> yield dive fillExpr fillExpr.Range traverseSynExpr ] |> pick expr - | SynExpr.Typed (synExpr, synType, _range) -> + | SynExpr.Typed(synExpr, synType, _range) -> match traverseSynExpr synExpr with | None -> traverseSynType synType | x -> x - | SynExpr.Tuple (_, synExprList, _, _range) - | SynExpr.ArrayOrList (_, synExprList, _range) -> + | SynExpr.Tuple(_, synExprList, _, _range) + | SynExpr.ArrayOrList(_, synExprList, _range) -> synExprList |> List.map (fun x -> dive x x.Range traverseSynExpr) |> pick expr - | SynExpr.AnonRecd (_isStruct, copyOpt, synExprList, _range) -> + | SynExpr.AnonRecd(_isStruct, copyOpt, synExprList, _range) -> [ match copyOpt with - | Some (expr, (withRange, _)) -> + | Some(expr, (withRange, _)) -> yield dive expr expr.Range traverseSynExpr yield @@ -428,7 +428,7 @@ module SyntaxTraversal = yield dive x x.Range traverseSynExpr ] |> pick expr - | SynExpr.Record (inheritOpt, copyOpt, fields, _range) -> + | SynExpr.Record(inheritOpt, copyOpt, fields, _range) -> [ let diveIntoSeparator offsideColumn scPosOpt copyOpt = match scPosOpt with | Some scPos -> @@ -444,7 +444,7 @@ module SyntaxTraversal = None match inheritOpt with - | Some (_ty, expr, _range, sepOpt, inheritRange) -> + | Some(_ty, expr, _range, sepOpt, inheritRange) -> // dive into argument yield dive expr expr.Range (fun expr -> @@ -461,7 +461,7 @@ module SyntaxTraversal = traverseSynExpr expr) match sepOpt with - | Some (sep, scPosOpt) -> + | Some(sep, scPosOpt) -> yield dive () sep (fun () -> // special case: caret is below 'inherit' + one or more fields are already defined @@ -473,7 +473,7 @@ module SyntaxTraversal = | _ -> () match copyOpt with - | Some (expr, (withRange, _)) -> + | Some(expr, (withRange, _)) -> yield dive expr expr.Range traverseSynExpr yield @@ -488,7 +488,7 @@ module SyntaxTraversal = let copyOpt = Option.map fst copyOpt - for SynExprRecordField (fieldName = (field, _); expr = e; blockSeparator = sepOpt) in fields do + for SynExprRecordField(fieldName = (field, _); expr = e; blockSeparator = sepOpt) in fields do yield dive (path, copyOpt, Some field) field.Range (fun r -> if rangeContainsPos field.Range pos then @@ -498,7 +498,7 @@ module SyntaxTraversal = let offsideColumn = match inheritOpt with - | Some (_, _, _, _, inheritRange) -> inheritRange.StartColumn + | Some(_, _, _, _, inheritRange) -> inheritRange.StartColumn | None -> field.Range.StartColumn match e with @@ -519,7 +519,7 @@ module SyntaxTraversal = | None -> () match sepOpt with - | Some (sep, scPosOpt) -> + | Some(sep, scPosOpt) -> yield dive () sep (fun () -> // special case: caret is between field bindings @@ -532,100 +532,100 @@ module SyntaxTraversal = ] |> pick expr - | SynExpr.New (_, _synType, synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.ObjExpr (objType = ty; argOptions = baseCallOpt; bindings = binds; members = ms; extraImpls = ifaces) -> + | SynExpr.New(_, _synType, synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.ObjExpr(objType = ty; argOptions = baseCallOpt; bindings = binds; members = ms; extraImpls = ifaces) -> let binds = unionBindingAndMembers binds ms let result = ifaces - |> Seq.map (fun (SynInterfaceImpl (interfaceTy = ty)) -> ty) + |> Seq.map (fun (SynInterfaceImpl(interfaceTy = ty)) -> ty) |> Seq.tryPick (fun ty -> visitor.VisitInterfaceSynMemberDefnType(path, ty)) if result.IsSome then result else [ match baseCallOpt with - | Some (expr, _) -> + | Some(expr, _) -> // this is like a call to 'new', so mock up a 'new' so we can recurse and use that existing logic let newCall = SynExpr.New(false, ty, expr, unionRanges ty.Range expr.Range) yield dive newCall newCall.Range traverseSynExpr | _ -> () for b in binds do yield dive b b.RangeOfBindingWithRhs (traverseSynBinding path) - for SynInterfaceImpl (bindings = binds) in ifaces do + for SynInterfaceImpl(bindings = binds) in ifaces do for b in binds do yield dive b b.RangeOfBindingWithRhs (traverseSynBinding path) ] |> pick expr - | SynExpr.While (_spWhile, synExpr, synExpr2, _range) -> + | SynExpr.While(_spWhile, synExpr, synExpr2, _range) -> [ dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.For (identBody = synExpr; toBody = synExpr2; doBody = synExpr3) -> + | SynExpr.For(identBody = synExpr; toBody = synExpr2; doBody = synExpr3) -> [ dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr dive synExpr3 synExpr3.Range traverseSynExpr ] |> pick expr - | SynExpr.ForEach (_spFor, _spIn, _seqExprOnly, _isFromSource, synPat, synExpr, synExpr2, _range) -> + | SynExpr.ForEach(_spFor, _spIn, _seqExprOnly, _isFromSource, synPat, synExpr, synExpr2, _range) -> [ dive synPat synPat.Range traversePat dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.ArrayOrListComputed (_, synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.ArrayOrListComputed(_, synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.ComputationExpr (_, synExpr, _range) -> + | SynExpr.ComputationExpr(_, synExpr, _range) -> // now parser treats this syntactic expression as computation expression // { identifier } // here we detect this situation and treat ComputationExpr { Identifier } as attempt to create record // note: sequence expressions use SynExpr.ComputationExpr too - they need to be filtered out let isPartOfArrayOrList = match origPath with - | SyntaxNode.SynExpr (SynExpr.ArrayOrListComputed _) :: _ -> true + | SyntaxNode.SynExpr(SynExpr.ArrayOrListComputed _) :: _ -> true | _ -> false let ok = match isPartOfArrayOrList, synExpr with | false, SynExpr.Ident ident -> visitor.VisitRecordField(path, None, Some(SynLongIdent([ ident ], [], [ None ]))) - | false, SynExpr.LongIdent (false, lidwd, _, _) -> visitor.VisitRecordField(path, None, Some lidwd) + | false, SynExpr.LongIdent(false, lidwd, _, _) -> visitor.VisitRecordField(path, None, Some lidwd) | _ -> None if ok.IsSome then ok else traverseSynExpr synExpr - | SynExpr.Lambda (args = synSimplePats; body = synExpr) -> + | SynExpr.Lambda(args = synSimplePats; body = synExpr) -> match synSimplePats with - | SynSimplePats.SimplePats (pats, _) -> + | SynSimplePats.SimplePats(pats, _) -> match visitor.VisitSimplePats(path, pats) with | None -> traverseSynExpr synExpr | x -> x | _ -> traverseSynExpr synExpr - | SynExpr.MatchLambda (_isExnMatch, _argm, synMatchClauseList, _spBind, _wholem) -> + | SynExpr.MatchLambda(_isExnMatch, _argm, synMatchClauseList, _spBind, _wholem) -> synMatchClauseList |> List.map (fun x -> dive x x.Range (traverseSynMatchClause path)) |> pick expr - | SynExpr.Match (expr = synExpr; clauses = synMatchClauseList) -> + | SynExpr.Match(expr = synExpr; clauses = synMatchClauseList) -> [ yield dive synExpr synExpr.Range traverseSynExpr yield! synMatchClauseList |> List.map (fun x -> dive x x.Range (traverseSynMatchClause path)) ] |> pick expr - | SynExpr.Do (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.Do(synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.Assert (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.Assert(synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.Fixed (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.Fixed(synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.DebugPoint (_, _, synExpr) -> traverseSynExpr synExpr + | SynExpr.DebugPoint(_, _, synExpr) -> traverseSynExpr synExpr // | SynExpr.Dynamic _ -> None - | SynExpr.App (_exprAtomicFlag, isInfix, synExpr, synExpr2, _range) -> + | SynExpr.App(_exprAtomicFlag, isInfix, synExpr, synExpr2, _range) -> if isInfix then [ dive synExpr2 synExpr2.Range traverseSynExpr dive synExpr synExpr.Range traverseSynExpr ] // reverse the args @@ -635,9 +635,9 @@ module SyntaxTraversal = dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.TypeApp (synExpr, _, _synTypeList, _commas, _, _, _range) -> traverseSynExpr synExpr + | SynExpr.TypeApp(synExpr, _, _synTypeList, _commas, _, _, _range) -> traverseSynExpr synExpr - | SynExpr.LetOrUse (_, isRecursive, synBindingList, synExpr, range, _) -> + | SynExpr.LetOrUse(_, isRecursive, synBindingList, synExpr, range, _) -> match visitor.VisitLetOrUse(path, isRecursive, traverseSynBinding path, synBindingList, range) with | None -> [ yield! @@ -647,28 +647,28 @@ module SyntaxTraversal = |> pick expr | x -> x - | SynExpr.TryWith (tryExpr = synExpr; withCases = synMatchClauseList) -> + | SynExpr.TryWith(tryExpr = synExpr; withCases = synMatchClauseList) -> [ yield dive synExpr synExpr.Range traverseSynExpr yield! synMatchClauseList |> List.map (fun x -> dive x x.Range (traverseSynMatchClause path)) ] |> pick expr - | SynExpr.TryFinally (tryExpr = synExpr; finallyExpr = synExpr2) -> + | SynExpr.TryFinally(tryExpr = synExpr; finallyExpr = synExpr2) -> [ dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.Lazy (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.Lazy(synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.SequentialOrImplicitYield (_sequencePointInfoForSequential, synExpr, synExpr2, _, _range) + | SynExpr.SequentialOrImplicitYield(_sequencePointInfoForSequential, synExpr, synExpr2, _, _range) - | SynExpr.Sequential (_sequencePointInfoForSequential, _, synExpr, synExpr2, _range) -> + | SynExpr.Sequential(_sequencePointInfoForSequential, _, synExpr, synExpr2, _range) -> [ dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.IfThenElse (ifExpr = synExpr; thenExpr = synExpr2; elseExpr = synExprOpt) -> + | SynExpr.IfThenElse(ifExpr = synExpr; thenExpr = synExpr2; elseExpr = synExprOpt) -> [ yield dive synExpr synExpr.Range traverseSynExpr yield dive synExpr2 synExpr2.Range traverseSynExpr match synExprOpt with @@ -678,20 +678,20 @@ module SyntaxTraversal = | SynExpr.Ident _ident -> None - | SynExpr.LongIdent (_, _longIdent, _altNameRefCell, _range) -> None + | SynExpr.LongIdent(_, _longIdent, _altNameRefCell, _range) -> None - | SynExpr.LongIdentSet (_longIdent, synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.LongIdentSet(_longIdent, synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.DotGet (synExpr, _dotm, _longIdent, _range) -> traverseSynExpr synExpr + | SynExpr.DotGet(synExpr, _dotm, _longIdent, _range) -> traverseSynExpr synExpr - | SynExpr.Set (synExpr, synExpr2, _) + | SynExpr.Set(synExpr, synExpr2, _) - | SynExpr.DotSet (synExpr, _, synExpr2, _) -> + | SynExpr.DotSet(synExpr, _, synExpr2, _) -> [ dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.IndexRange (expr1, _, expr2, _, _, _) -> + | SynExpr.IndexRange(expr1, _, expr2, _, _, _) -> [ match expr1 with | Some e -> dive e e.Range traverseSynExpr | None -> () @@ -700,78 +700,78 @@ module SyntaxTraversal = | None -> () ] |> pick expr - | SynExpr.IndexFromEnd (e, _) -> traverseSynExpr e + | SynExpr.IndexFromEnd(e, _) -> traverseSynExpr e - | SynExpr.DotIndexedGet (synExpr, indexArgs, _range, _range2) -> + | SynExpr.DotIndexedGet(synExpr, indexArgs, _range, _range2) -> [ yield dive synExpr synExpr.Range traverseSynExpr yield dive indexArgs indexArgs.Range traverseSynExpr ] |> pick expr - | SynExpr.DotIndexedSet (synExpr, indexArgs, synExpr2, _, _range, _range2) -> + | SynExpr.DotIndexedSet(synExpr, indexArgs, synExpr2, _, _range, _range2) -> [ yield dive synExpr synExpr.Range traverseSynExpr yield dive indexArgs indexArgs.Range traverseSynExpr yield dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.JoinIn (synExpr1, _range, synExpr2, _range2) -> + | SynExpr.JoinIn(synExpr1, _range, synExpr2, _range2) -> [ dive synExpr1 synExpr1.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.NamedIndexedPropertySet (_longIdent, synExpr, synExpr2, _range) -> + | SynExpr.NamedIndexedPropertySet(_longIdent, synExpr, synExpr2, _range) -> [ dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.DotNamedIndexedPropertySet (synExpr, _longIdent, synExpr2, synExpr3, _range) -> + | SynExpr.DotNamedIndexedPropertySet(synExpr, _longIdent, synExpr2, synExpr3, _range) -> [ dive synExpr synExpr.Range traverseSynExpr dive synExpr2 synExpr2.Range traverseSynExpr dive synExpr3 synExpr3.Range traverseSynExpr ] |> pick expr - | SynExpr.TypeTest (synExpr, synType, _range) + | SynExpr.TypeTest(synExpr, synType, _range) - | SynExpr.Upcast (synExpr, synType, _range) + | SynExpr.Upcast(synExpr, synType, _range) - | SynExpr.Downcast (synExpr, synType, _range) -> + | SynExpr.Downcast(synExpr, synType, _range) -> [ dive synExpr synExpr.Range traverseSynExpr dive synType synType.Range traverseSynType ] |> pick expr - | SynExpr.InferredUpcast (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.InferredUpcast(synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.InferredDowncast (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.InferredDowncast(synExpr, _range) -> traverseSynExpr synExpr | SynExpr.Null _range -> None - | SynExpr.AddressOf (_, synExpr, _range, _range2) -> traverseSynExpr synExpr + | SynExpr.AddressOf(_, synExpr, _range, _range2) -> traverseSynExpr synExpr - | SynExpr.TraitCall (_synTyparList, _synMemberSig, synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.TraitCall(_synTyparList, _synMemberSig, synExpr, _range) -> traverseSynExpr synExpr | SynExpr.ImplicitZero _range -> None - | SynExpr.YieldOrReturn (_, synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.YieldOrReturn(_, synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.YieldOrReturnFrom (_, synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.YieldOrReturnFrom(_, synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.LetOrUseBang (pat = synPat; rhs = synExpr; andBangs = andBangSynExprs; body = synExpr2) -> + | SynExpr.LetOrUseBang(pat = synPat; rhs = synExpr; andBangs = andBangSynExprs; body = synExpr2) -> [ yield dive synPat synPat.Range traversePat yield dive synExpr synExpr.Range traverseSynExpr yield! - [ for SynExprAndBang (pat = andBangSynPat; body = andBangSynExpr) in andBangSynExprs do + [ for SynExprAndBang(pat = andBangSynPat; body = andBangSynExpr) in andBangSynExprs do yield (dive andBangSynPat andBangSynPat.Range traversePat) yield (dive andBangSynExpr andBangSynExpr.Range traverseSynExpr) ] yield dive synExpr2 synExpr2.Range traverseSynExpr ] |> pick expr - | SynExpr.MatchBang (expr = synExpr; clauses = synMatchClauseList) -> + | SynExpr.MatchBang(expr = synExpr; clauses = synMatchClauseList) -> [ yield dive synExpr synExpr.Range traverseSynExpr yield! synMatchClauseList |> List.map (fun x -> dive x x.Range (traverseSynMatchClause path)) ] |> pick expr - | SynExpr.DoBang (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.DoBang(synExpr, _range) -> traverseSynExpr synExpr | SynExpr.LibraryOnlyILAssembly _ -> None @@ -781,11 +781,11 @@ module SyntaxTraversal = | SynExpr.LibraryOnlyUnionCaseFieldSet _ -> None - | SynExpr.ArbitraryAfterError (_debugStr, _range) -> None + | SynExpr.ArbitraryAfterError(_debugStr, _range) -> None - | SynExpr.FromParseError (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.FromParseError(synExpr, _range) -> traverseSynExpr synExpr - | SynExpr.DiscardAfterMissingQualificationAfterDot (synExpr, _range) -> traverseSynExpr synExpr + | SynExpr.DiscardAfterMissingQualificationAfterDot(synExpr, _range) -> traverseSynExpr synExpr visitor.VisitExpr(origPath, traverseSynExpr origPath, defaultTraverse, expr) @@ -794,19 +794,18 @@ module SyntaxTraversal = let path = SyntaxNode.SynPat p :: origPath match p with - | SynPat.Paren (p, _) -> traversePat path p - | SynPat.As (p1, p2, _) - | SynPat.Or (p1, p2, _, _) -> [ p1; p2 ] |> List.tryPick (traversePat path) - | SynPat.Ands (ps, _) - | SynPat.Tuple (_, ps, _) - | SynPat.ArrayOrList (_, ps, _) -> ps |> List.tryPick (traversePat path) - | SynPat.Attrib (p, _, _) -> traversePat path p - | SynPat.LongIdent (argPats = args) -> + | SynPat.Paren(p, _) -> traversePat path p + | SynPat.As(p1, p2, _) + | SynPat.Or(p1, p2, _, _) -> [ p1; p2 ] |> List.tryPick (traversePat path) + | SynPat.Ands(ps, _) + | SynPat.Tuple(_, ps, _) + | SynPat.ArrayOrList(_, ps, _) -> ps |> List.tryPick (traversePat path) + | SynPat.Attrib(p, _, _) -> traversePat path p + | SynPat.LongIdent(argPats = args) -> match args with | SynArgPats.Pats ps -> ps |> List.tryPick (traversePat path) - | SynArgPats.NamePatPairs (ps, _) -> - ps |> List.map (fun (_, _, pat) -> pat) |> List.tryPick (traversePat path) - | SynPat.Typed (p, ty, _) -> + | SynArgPats.NamePatPairs(ps, _) -> ps |> List.map (fun (_, _, pat) -> pat) |> List.tryPick (traversePat path) + | SynPat.Typed(p, ty, _) -> match traversePat path p with | None -> traverseSynType path ty | x -> x @@ -819,18 +818,18 @@ module SyntaxTraversal = let path = SyntaxNode.SynType ty :: origPath match ty with - | SynType.App (typeName, _, typeArgs, _, _, _, _) - | SynType.LongIdentApp (typeName, _, _, typeArgs, _, _, _) -> + | SynType.App(typeName, _, typeArgs, _, _, _, _) + | SynType.LongIdentApp(typeName, _, _, typeArgs, _, _, _) -> [ yield typeName; yield! typeArgs ] |> List.tryPick (traverseSynType path) - | SynType.Fun (ty1, ty2, _) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) - | SynType.MeasurePower (ty, _, _) - | SynType.HashConstraint (ty, _) - | SynType.WithGlobalConstraints (ty, _, _) - | SynType.Array (_, ty, _) -> traverseSynType path ty - | SynType.StaticConstantNamed (ty1, ty2, _) - | SynType.MeasureDivide (ty1, ty2, _) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) - | SynType.Tuple (_, tys, _) -> tys |> List.map snd |> List.tryPick (traverseSynType path) - | SynType.StaticConstantExpr (expr, _) -> traverseSynExpr [] expr + | SynType.Fun(ty1, ty2, _) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) + | SynType.MeasurePower(ty, _, _) + | SynType.HashConstraint(ty, _) + | SynType.WithGlobalConstraints(ty, _, _) + | SynType.Array(_, ty, _) -> traverseSynType path ty + | SynType.StaticConstantNamed(ty1, ty2, _) + | SynType.MeasureDivide(ty1, ty2, _) -> [ ty1; ty2 ] |> List.tryPick (traverseSynType path) + | SynType.Tuple(_, tys, _) -> tys |> List.map snd |> List.tryPick (traverseSynType path) + | SynType.StaticConstantExpr(expr, _) -> traverseSynExpr [] expr | SynType.Anon _ -> None | _ -> None @@ -848,10 +847,10 @@ module SyntaxTraversal = match mems |> Seq.toList with | [ mem ] -> // the typical case, a single member has this range 'r' Some(dive mem r (traverseSynMemberDefn path traverseInherit)) - | [ SynMemberDefn.Member(memberDefn = SynBinding(headPat = SynPat.LongIdent (longDotId = lid1 - extraId = Some (info1)))) as mem1 - SynMemberDefn.Member(memberDefn = SynBinding(headPat = SynPat.LongIdent (longDotId = lid2 - extraId = Some (info2)))) as mem2 ] -> // can happen if one is a getter and one is a setter + | [ SynMemberDefn.Member( + memberDefn = SynBinding(headPat = SynPat.LongIdent(longDotId = lid1; extraId = Some(info1)))) as mem1 + SynMemberDefn.Member( + memberDefn = SynBinding(headPat = SynPat.LongIdent(longDotId = lid2; extraId = Some(info2)))) as mem2 ] -> // can happen if one is a getter and one is a setter // ensure same long id assert ((lid1.LongIdent, lid2.LongIdent) @@ -889,7 +888,7 @@ module SyntaxTraversal = and traverseSynTypeDefn origPath - (SynTypeDefn (synComponentInfo, synTypeDefnRepr, synMemberDefns, _, tRange, _) as tydef) + (SynTypeDefn(synComponentInfo, synTypeDefnRepr, synMemberDefns, _, tRange, _) as tydef) = let path = SyntaxNode.SynTypeDefn tydef :: origPath @@ -901,7 +900,7 @@ module SyntaxTraversal = // This node is generated in CheckExpressions.fs, not in the AST. // But note exception declarations are missing from this tree walk. () - | SynTypeDefnRepr.ObjectModel (synTypeDefnKind, synMemberDefns, _oRange) -> + | SynTypeDefnRepr.ObjectModel(synTypeDefnKind, synMemberDefns, _oRange) -> // traverse inherit function is used to capture type specific data required for processing Inherit part let traverseInherit (synType: SynType, range: range) = visitor.VisitInheritSynMemberDefn(path, synComponentInfo, synTypeDefnKind, synType, synMemberDefns, range) @@ -909,15 +908,15 @@ module SyntaxTraversal = yield! synMemberDefns |> normalizeMembersToDealWithPeculiaritiesOfGettersAndSetters path traverseInherit - | SynTypeDefnRepr.Simple (synTypeDefnSimpleRepr, _range) -> + | SynTypeDefnRepr.Simple(synTypeDefnSimpleRepr, _range) -> match synTypeDefnSimpleRepr with - | SynTypeDefnSimpleRepr.Record (_synAccessOption, fields, m) -> + | SynTypeDefnSimpleRepr.Record(_synAccessOption, fields, m) -> yield dive () synTypeDefnRepr.Range (fun () -> visitor.VisitRecordDefn(path, fields, m)) - | SynTypeDefnSimpleRepr.Union (_synAccessOption, cases, m) -> + | SynTypeDefnSimpleRepr.Union(_synAccessOption, cases, m) -> yield dive () synTypeDefnRepr.Range (fun () -> visitor.VisitUnionDefn(path, cases, m)) - | SynTypeDefnSimpleRepr.Enum (cases, m) -> + | SynTypeDefnSimpleRepr.Enum(cases, m) -> yield dive () synTypeDefnRepr.Range (fun () -> visitor.VisitEnumDefn(path, cases, m)) - | SynTypeDefnSimpleRepr.TypeAbbrev (_, synType, m) -> + | SynTypeDefnSimpleRepr.TypeAbbrev(_, synType, m) -> yield dive synTypeDefnRepr synTypeDefnRepr.Range (fun _ -> visitor.VisitTypeAbbrev(path, synType, m)) | _ -> () yield! @@ -930,13 +929,13 @@ module SyntaxTraversal = let path = SyntaxNode.SynMemberDefn m :: path match m with - | SynMemberDefn.Open (_longIdent, _range) -> None - | SynMemberDefn.Member (synBinding, _range) -> traverseSynBinding path synBinding - | SynMemberDefn.ImplicitCtor (_synAccessOption, _synAttributes, simplePats, _identOption, _doc, _range) -> + | SynMemberDefn.Open(_longIdent, _range) -> None + | SynMemberDefn.Member(synBinding, _range) -> traverseSynBinding path synBinding + | SynMemberDefn.ImplicitCtor(_synAccessOption, _synAttributes, simplePats, _identOption, _doc, _range) -> match simplePats with - | SynSimplePats.SimplePats (simplePats, _) -> visitor.VisitSimplePats(path, simplePats) + | SynSimplePats.SimplePats(simplePats, _) -> visitor.VisitSimplePats(path, simplePats) | _ -> None - | SynMemberDefn.ImplicitInherit (synType, synExpr, _identOption, range) -> + | SynMemberDefn.ImplicitInherit(synType, synExpr, _identOption, range) -> [ dive () synType.Range (fun () -> match traverseInherit (synType, range) with | None -> visitor.VisitImplicitInherit(path, traverseSynExpr path, synType, synExpr, range) @@ -944,36 +943,36 @@ module SyntaxTraversal = dive () synExpr.Range (fun () -> visitor.VisitImplicitInherit(path, traverseSynExpr path, synType, synExpr, range)) ] |> pick m - | SynMemberDefn.AutoProperty (synExpr = synExpr) -> traverseSynExpr path synExpr - | SynMemberDefn.LetBindings (synBindingList, isRecursive, _, range) -> + | SynMemberDefn.AutoProperty(synExpr = synExpr) -> traverseSynExpr path synExpr + | SynMemberDefn.LetBindings(synBindingList, isRecursive, _, range) -> match visitor.VisitLetOrUse(path, isRecursive, traverseSynBinding path, synBindingList, range) with | Some x -> Some x | None -> synBindingList |> List.map (fun x -> dive x x.RangeOfBindingWithRhs (traverseSynBinding path)) |> pick m - | SynMemberDefn.AbstractSlot (_synValSig, _memberFlags, _range) -> None - | SynMemberDefn.Interface (interfaceType = synType; members = synMemberDefnsOption) -> + | SynMemberDefn.AbstractSlot(_synValSig, _memberFlags, _range) -> None + | SynMemberDefn.Interface(interfaceType = synType; members = synMemberDefnsOption) -> match visitor.VisitInterfaceSynMemberDefnType(path, synType) with | None -> match synMemberDefnsOption with | None -> None - | Some (x) -> + | Some(x) -> [ yield! x |> normalizeMembersToDealWithPeculiaritiesOfGettersAndSetters path (fun _ -> None) ] |> pick x | ok -> ok - | SynMemberDefn.Inherit (synType, _identOption, range) -> traverseInherit (synType, range) - | SynMemberDefn.ValField (_synField, _range) -> None - | SynMemberDefn.NestedType (synTypeDefn, _synAccessOption, _range) -> traverseSynTypeDefn path synTypeDefn + | SynMemberDefn.Inherit(synType, _identOption, range) -> traverseInherit (synType, range) + | SynMemberDefn.ValField(_synField, _range) -> None + | SynMemberDefn.NestedType(synTypeDefn, _synAccessOption, _range) -> traverseSynTypeDefn path synTypeDefn and traverseSynMatchClause origPath mc = let defaultTraverse mc = let path = SyntaxNode.SynMatchClause mc :: origPath match mc with - | SynMatchClause (pat = synPat; whenExpr = synExprOption; resultExpr = synExpr) as all -> + | SynMatchClause(pat = synPat; whenExpr = synExprOption; resultExpr = synExpr) as all -> [ dive synPat synPat.Range (traversePat path) ] @ ([ match synExprOption with | None -> () @@ -989,7 +988,7 @@ module SyntaxTraversal = let path = SyntaxNode.SynBinding b :: origPath match b with - | SynBinding (headPat = synPat; expr = synExpr) -> + | SynBinding(headPat = synPat; expr = synExpr) -> match traversePat path synPat with | None -> traverseSynExpr path synExpr | x -> x @@ -997,7 +996,7 @@ module SyntaxTraversal = visitor.VisitBinding(origPath, defaultTraverse, b) match parseTree with - | ParsedInput.ImplFile (ParsedImplFileInput (modules = l)) -> + | ParsedInput.ImplFile(ParsedImplFileInput(modules = l)) -> let fileRange = #if DEBUG match l with diff --git a/src/FsAutoComplete.Core/paket.references b/src/FsAutoComplete.Core/paket.references deleted file mode 100644 index 2290a3a13..000000000 --- a/src/FsAutoComplete.Core/paket.references +++ /dev/null @@ -1,15 +0,0 @@ -FSharp.Compiler.Service -FSharp.Analyzers.SDK -Newtonsoft.Json -ICSharpCode.Decompiler -Microsoft.SourceLink.GitHub -System.Configuration.ConfigurationManager -FSharp.UMX -FsToolkit.ErrorHandling -Fantomas.Client - -Ionide.ProjInfo.ProjectSystem -System.Reflection.Metadata -Microsoft.Build.Utilities.Core -Ionide.LanguageServerProtocol -Ionide.KeepAChangelog.Tasks diff --git a/src/FsAutoComplete.Logging/FsAutoComplete.Logging.fsproj b/src/FsAutoComplete.Logging/FsAutoComplete.Logging.fsproj index a0fdf42e3..a4455cf40 100644 --- a/src/FsAutoComplete.Logging/FsAutoComplete.Logging.fsproj +++ b/src/FsAutoComplete.Logging/FsAutoComplete.Logging.fsproj @@ -5,10 +5,6 @@ false - - True - paket-files/FsLibLog.fs - + - diff --git a/src/FsAutoComplete.Logging/FsLibLog.fs b/src/FsAutoComplete.Logging/FsLibLog.fs new file mode 100644 index 000000000..43d932456 --- /dev/null +++ b/src/FsAutoComplete.Logging/FsLibLog.fs @@ -0,0 +1,779 @@ +namespace FsAutoComplete.Logging + + +[] +module Types = + open System + + type LogLevel = + | Trace = 0 + | Debug = 1 + | Info = 2 + | Warn = 3 + | Error = 4 + | Fatal = 5 + + /// An optional message thunk. + /// + /// - If `None` is provided, this typically signals to the logger to do a isEnabled check. + /// - If `Some` is provided, this signals the logger to log. + type MessageThunk = (unit -> string) option + + /// The signature of a log message function + type Logger = LogLevel -> MessageThunk -> exn option -> obj array -> bool + type MappedContext = string -> obj -> bool -> IDisposable + + /// Type representing a Log + type Log = + { LogLevel: LogLevel + Message: MessageThunk + Exception: exn option + Parameters: obj list + AdditionalNamedParameters: ((string * obj * bool) list) } + + static member StartLogLevel(logLevel: LogLevel) = + { LogLevel = logLevel + Message = None + Exception = None + Parameters = List.empty + AdditionalNamedParameters = List.empty } + + /// An interface wrapper for `Logger`. Useful when using depedency injection frameworks. + type ILog = + abstract member Log: Logger + abstract member MappedContext: MappedContext + + [] + module Inner = + open System.Collections.Generic + + type DisposableStack() = + let stack = Stack() + + interface IDisposable with + member __.Dispose() = + while stack.Count > 0 do + stack.Pop().Dispose() + + member __.Push(item: IDisposable) = stack.Push item + member __.Push(items: IDisposable list) = items |> List.iter stack.Push + + static member Create(items: IDisposable list) = + let ds = new DisposableStack() + ds.Push items + ds + + type ILog with + + /// **Description** + /// + /// Logs a log + /// + /// **Parameters** + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `bool` + member logger.fromLog(log: Log) = + use __ = + log.AdditionalNamedParameters + |> List.map (fun (key, value, destructure) -> logger.MappedContext key value destructure) + // This stack is important, it causes us to unwind as if you have multiple uses in a row + |> DisposableStack.Create + + log.Parameters + |> List.toArray + |> logger.Log log.LogLevel log.Message log.Exception + + /// **Description** + /// + /// Logs a fatal log message given a log configurer. Lets caller know if log was sent with boolean return. + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `bool` + member logger.fatal'(logConfig: Log -> Log) = + Log.StartLogLevel LogLevel.Fatal |> logConfig |> logger.fromLog + + /// **Description** + /// + /// Logs a fatal log message given a log configurer + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `unit` + member logger.fatal(logConfig: Log -> Log) = logger.fatal' logConfig |> ignore + + /// **Description** + /// + /// Logs a error log message given a log configurer. Lets caller know if log was sent with boolean return. + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `bool` + member logger.error'(logConfig: Log -> Log) = + Log.StartLogLevel LogLevel.Error |> logConfig |> logger.fromLog + + /// **Description** + /// + /// Logs an error log message given a log configurer + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `unit` + member logger.error(logConfig: Log -> Log) = logger.error' logConfig |> ignore + + /// **Description** + /// + /// Logs a warn log message given a log configurer. Lets caller know if log was sent with boolean return. + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `bool` + member logger.warn'(logConfig: Log -> Log) = + Log.StartLogLevel LogLevel.Warn |> logConfig |> logger.fromLog + + /// **Description** + /// + /// Logs a warn log message given a log configurer + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `unit` + member logger.warn(logConfig: Log -> Log) = logger.warn' logConfig |> ignore + + /// **Description** + /// + /// Logs a info log message given a log configurer. Lets caller know if log was sent with boolean return. + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `bool` + member logger.info'(logConfig: Log -> Log) = + Log.StartLogLevel LogLevel.Info |> logConfig |> logger.fromLog + + /// **Description** + /// + /// Logs a info log message given a log configurer + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `unit` + member logger.info(logConfig: Log -> Log) = logger.info' logConfig |> ignore + + /// **Description** + /// + /// Logs a debug log message given a log configurer. Lets caller know if log was sent with boolean return. + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `bool` + member logger.debug'(logConfig: Log -> Log) = + Log.StartLogLevel LogLevel.Debug |> logConfig |> logger.fromLog + + /// **Description** + /// + /// Logs a debug log message given a log configurer + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `unit` + member logger.debug(logConfig: Log -> Log) = logger.debug' logConfig |> ignore + + /// **Description** + /// + /// Logs a trace log message given a log configurer. Lets caller know if log was sent with boolean return. + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `bool` + member logger.trace'(logConfig: Log -> Log) = + Log.StartLogLevel LogLevel.Trace |> logConfig |> logger.fromLog + + /// **Description** + /// + /// Logs a trace log message given a log configurer + /// + /// **Parameters** + /// * `logConfig` - parameter of type `Log -> Log` + /// + /// **Output Type** + /// * `unit` + member logger.trace(logConfig: Log -> Log) = logger.trace' logConfig |> ignore + + + /// An interface for retrieving a concrete logger such as Serilog, Nlog, etc. + type ILogProvider = + abstract member GetLogger: string -> Logger + abstract member OpenNestedContext: string -> IDisposable + abstract member OpenMappedContext: string -> obj -> bool -> IDisposable + + module Log = + + /// **Description** + /// + /// Amends a `Log` with a message + /// + /// **Parameters** + /// * `message` - parameter of type `string` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + let setMessage (message: string) (log: Log) = + { log with + Message = Some(fun () -> message) } + + /// **Description** + /// + /// Amends a `Log` with a message thunk. Useful for "expensive" string construction scenarios. + /// + /// **Parameters** + /// * `messageThunk` - parameter of type `unit -> string` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + /// + /// **Exceptions** + /// + let setMessageThunk (messageThunk: unit -> string) (log: Log) = + { log with Message = Some messageThunk } + + /// **Description** + /// + /// Amends a `Log` with a parameter. + /// + /// **Parameters** + /// * `param` - parameter of type `'a` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + /// + /// **Exceptions** + /// + let addParameter (param: 'a) (log: Log) = + { log with + Parameters = List.append log.Parameters [ (box param) ] } + + /// **Description** + /// + /// Amends a `Log` with a list of parameters. + /// + /// **Parameters** + /// * `params` - parameter of type `obj list` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + /// + /// **Exceptions** + /// + let addParameters (``params``: obj list) (log: Log) = + let ``params`` = ``params`` |> List.map box + + { log with + Parameters = log.Parameters @ ``params`` } + + + + /// **Description** + /// + /// Amends a `Log` with additional named parameters for context. This helper adds more context to a log. + /// This DOES NOT affect the parameters set for a message template. + /// This is the same calling OpenMappedContext right before logging. + /// + /// **Parameters** + /// * `key` - parameter of type `string` + /// * `value` - parameter of type `obj` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + /// + /// **Exceptions** + /// + let addContext (key: string) (value: obj) (log: Log) = + { log with + AdditionalNamedParameters = List.append log.AdditionalNamedParameters [ key, (box value), false ] } + + + /// **Description** + /// + /// Amends a `Log` with additional named parameters for context. This helper adds more context to a log. + /// This DOES NOT affect the parameters set for a message template. + /// This is the same calling OpenMappedContext right before logging. + /// This destructures an object rather than calling `ToString()` on it. + /// WARNING: Destructring can be expensive. + /// + /// **Parameters** + /// * `key` - parameter of type `string` + /// * `value` - parameter of type `obj` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + /// + /// **Exceptions** + /// + let addContextDestructured (key: string) (value: obj) (log: Log) = + { log with + AdditionalNamedParameters = List.append log.AdditionalNamedParameters [ key, (box value), true ] } + + + /// **Description** + /// + /// Amends a `Log` with an `exn`. Handles nulls. + /// + /// **Parameters** + /// * `exception` - parameter of type `exn` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + /// + /// **Exceptions** + /// + let addException (``exception``: exn) (log: Log) = + { log with + Exception = Option.ofObj ``exception`` } + + /// **Description** + /// + /// Amends a `Log` with an `exn`. Handles nulls. + /// + /// **Parameters** + /// * `exception` - parameter of type `exn` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + /// + /// **Exceptions** + /// + let addExn (``exception``: exn) (log: Log) = addException ``exception`` log + + /// **Description** + /// + /// Amends a `Log` with a given `LogLevel` + /// + /// **Parameters** + /// * `logLevel` - parameter of type `LogLevel` + /// * `log` - parameter of type `Log` + /// + /// **Output Type** + /// * `Log` + /// + /// **Exceptions** + /// + let setLogLevel (logLevel: LogLevel) (log: Log) = { log with LogLevel = logLevel } + +module Providers = + module SerilogProvider = + open System + open System.Linq.Expressions + + let getLogManagerType () = Type.GetType("Serilog.Log, Serilog") + let isAvailable () = getLogManagerType () |> isNull |> not + + let getPushProperty () = + + let ndcContextType = + Type.GetType("Serilog.Context.LogContext, Serilog") + |> Option.ofObj + |> Option.defaultWith (fun () -> Type.GetType("Serilog.Context.LogContext, Serilog.FullNetFx")) + + () + + let pushPropertyMethod = + ndcContextType.GetMethod("PushProperty", [| typedefof; typedefof; typedefof |]) + + let nameParam = Expression.Parameter(typedefof, "name") + let valueParam = Expression.Parameter(typedefof, "value") + + let destructureObjectParam = + Expression.Parameter(typedefof, "destructureObjects") + + let pushPropertyMethodCall = + Expression.Call(null, pushPropertyMethod, nameParam, valueParam, destructureObjectParam) + + let pushProperty = + Expression + .Lambda>( + pushPropertyMethodCall, + nameParam, + valueParam, + destructureObjectParam + ) + .Compile() + + fun key value destructure -> pushProperty.Invoke(key, value, destructure) + + + let getForContextMethodCall () = + let logManagerType = getLogManagerType () + + let method = + logManagerType.GetMethod("ForContext", [| typedefof; typedefof; typedefof |]) + + let propertyNameParam = Expression.Parameter(typedefof, "propertyName") + let valueParam = Expression.Parameter(typedefof, "value") + + let destructureObjectsParam = + Expression.Parameter(typedefof, "destructureObjects") + + let exrs: Expression[] = + [| propertyNameParam; valueParam; destructureObjectsParam |] + + let methodCall = Expression.Call(null, method, exrs) + + let func = + Expression + .Lambda>(methodCall, propertyNameParam, valueParam, destructureObjectsParam) + .Compile() + + fun name -> func.Invoke("SourceContext", name, false) + + type SerilogGateway = + { Write: obj -> obj -> string -> obj[] -> unit + WriteException: obj -> obj -> exn -> string -> obj[] -> unit + IsEnabled: obj -> obj -> bool + TranslateLevel: LogLevel -> obj } + + static member Create() = + let logEventLevelType = Type.GetType("Serilog.Events.LogEventLevel, Serilog") + + if (logEventLevelType |> isNull) then + failwith ("Type Serilog.Events.LogEventLevel was not found.") + + let debugLevel = Enum.Parse(logEventLevelType, "Debug", false) + let errorLevel = Enum.Parse(logEventLevelType, "Error", false) + let fatalLevel = Enum.Parse(logEventLevelType, "Fatal", false) + let informationLevel = Enum.Parse(logEventLevelType, "Information", false) + let verboseLevel = Enum.Parse(logEventLevelType, "Verbose", false) + let warningLevel = Enum.Parse(logEventLevelType, "Warning", false) + + let translateLevel (level: LogLevel) = + match level with + | LogLevel.Fatal -> fatalLevel + | LogLevel.Error -> errorLevel + | LogLevel.Warn -> warningLevel + | LogLevel.Info -> informationLevel + | LogLevel.Debug -> debugLevel + | LogLevel.Trace -> verboseLevel + | _ -> debugLevel + + let loggerType = Type.GetType("Serilog.ILogger, Serilog") + + if (loggerType |> isNull) then + failwith ("Type Serilog.ILogger was not found.") + + let isEnabledMethodInfo = loggerType.GetMethod("IsEnabled", [| logEventLevelType |]) + let instanceParam = Expression.Parameter(typedefof) + let instanceCast = Expression.Convert(instanceParam, loggerType) + let levelParam = Expression.Parameter(typedefof) + let levelCast = Expression.Convert(levelParam, logEventLevelType) + + let isEnabledMethodCall = + Expression.Call(instanceCast, isEnabledMethodInfo, levelCast) + + let isEnabled = + Expression + .Lambda>(isEnabledMethodCall, instanceParam, levelParam) + .Compile() + + let writeMethodInfo = + loggerType.GetMethod("Write", [| logEventLevelType; typedefof; typedefof |]) + + let messageParam = Expression.Parameter(typedefof) + let propertyValuesParam = Expression.Parameter(typedefof) + + let writeMethodExp = + Expression.Call(instanceCast, writeMethodInfo, levelCast, messageParam, propertyValuesParam) + + let expression = + Expression.Lambda>( + writeMethodExp, + instanceParam, + levelParam, + messageParam, + propertyValuesParam + ) + + let write = expression.Compile() + + let writeExceptionMethodInfo = + loggerType.GetMethod("Write", [| logEventLevelType; typedefof; typedefof; typedefof |]) + + let exceptionParam = Expression.Parameter(typedefof) + + let writeMethodExp = + Expression.Call( + instanceCast, + writeExceptionMethodInfo, + levelCast, + exceptionParam, + messageParam, + propertyValuesParam + ) + + let writeException = + Expression + .Lambda>( + writeMethodExp, + instanceParam, + levelParam, + exceptionParam, + messageParam, + propertyValuesParam + ) + .Compile() + + { Write = + (fun logger level message formattedParmeters -> write.Invoke(logger, level, message, formattedParmeters)) + WriteException = + fun logger level ex message formattedParmeters -> + writeException.Invoke(logger, level, ex, message, formattedParmeters) + IsEnabled = fun logger level -> isEnabled.Invoke(logger, level) + TranslateLevel = translateLevel } + + type private SerigLogProvider() = + let getLoggerByName = getForContextMethodCall () + let pushProperty = getPushProperty () + let serilogGatewayInit = lazy (SerilogGateway.Create()) + + let writeMessage logger logLevel (messageFunc: MessageThunk) ``exception`` formatParams = + let serilogGateway = serilogGatewayInit.Value + let translatedValue = serilogGateway.TranslateLevel logLevel + + match messageFunc with + | None -> serilogGateway.IsEnabled logger translatedValue + | Some _ when serilogGateway.IsEnabled logger translatedValue |> not -> false + | Some m -> + match ``exception`` with + | Some ex -> serilogGateway.WriteException logger translatedValue ex (m ()) formatParams + | None -> serilogGateway.Write logger translatedValue (m ()) formatParams + + true + + interface ILogProvider with + member this.GetLogger(name: string) : Logger = getLoggerByName name |> writeMessage + + member this.OpenMappedContext (key: string) (value: obj) (destructure: bool) : IDisposable = + pushProperty key value destructure + + member this.OpenNestedContext(message: string) : IDisposable = pushProperty "NDC" message false + + let create () = SerigLogProvider() :> ILogProvider + + + +module LogProvider = + open System + open Types + open Providers + open System.Diagnostics + open Microsoft.FSharp.Quotations.Patterns + + let mutable private currentLogProvider = None + + let private knownProviders = + [ (SerilogProvider.isAvailable, SerilogProvider.create) ] + + /// Greedy search for first available LogProvider. Order of known providers matters. + let private resolvedLogger = + lazy + (knownProviders + |> Seq.tryFind (fun (isAvailable, _) -> isAvailable ()) + |> Option.map (fun (_, create) -> create ())) + + let private noopLogger _ _ _ _ = false + + let private noopDisposable = + { new IDisposable with + member __.Dispose() = () } + + /// **Description** + /// + /// Allows custom override when `getLogger` searches for a LogProvider. + /// + /// **Parameters** + /// * `provider` - parameter of type `ILogProvider` + /// + /// **Output Type** + /// * `unit` + let setLoggerProvider (logProvider: ILogProvider) = currentLogProvider <- Some logProvider + + let getCurrentLogProvider () = + match currentLogProvider with + | None -> resolvedLogger.Value + | Some p -> Some p + + /// **Description** + /// + /// Opens a mapped diagnostic context. This will allow you to set additional parameters to a log given a scope. + /// + /// **Parameters** + /// * `key` - parameter of type `string` - The name of the property. + /// * `value` - parameter of type `obj` - The value of the property. + /// * `destructureObjects` - parameter of type `bool` - If true, and the value is a non-primitive, non-array type, then the value will be converted to a structure; otherwise, unknown types will be converted to scalars, which are generally stored as strings. WARNING: Destructring can be expensive. + /// + /// **Output Type** + /// * `IDisposable` + let openMappedContextDestucturable (key: string) (value: obj) (destructureObjects: bool) = + let provider = getCurrentLogProvider () + + match provider with + | Some p -> p.OpenMappedContext key value destructureObjects + | None -> noopDisposable + + /// **Description** + /// + /// Opens a mapped diagnostic context. This will allow you to set additional parameters to a log given a scope. Sets destructureObjects to false. + /// + /// **Parameters** + /// * `key` - parameter of type `string` - The name of the property. + /// * `value` - parameter of type `obj` - The value of the property. + /// + /// **Output Type** + /// * `IDisposable` + let openMappedContext (key: string) (value: obj) = + //TODO: We should try to find out if the value is a primitive + openMappedContextDestucturable key value false + + /// **Description** + /// + /// Opens a nested diagnostic context. This will allow you to set additional parameters to a log given a scope. + /// + /// **Parameters** + /// * `value` - parameter of type `string` - The value of the property. + /// + /// **Output Type** + /// * `IDisposable` + let openNestedContext (value: string) = + let provider = getCurrentLogProvider () + + match provider with + | Some p -> p.OpenNestedContext value + | None -> noopDisposable + + /// **Description** + /// + /// Creates a logger given a `string`. This will attempt to retrieve any loggers set with `setLoggerProvider`. It will fallback to a known list of providers. + /// + /// **Parameters** + /// * `string` - parameter of type `string` + /// + /// **Output Type** + /// * `ILog` + let getLoggerByName (name: string) = + let loggerProvider = getCurrentLogProvider () + + let logFunc = + match loggerProvider with + | Some loggerProvider -> loggerProvider.GetLogger(name) + | None -> noopLogger + + { new ILog with + member x.Log = logFunc + member x.MappedContext = openMappedContextDestucturable } + + /// **Description** + /// + /// Creates a logger given a `Type`. This will attempt to retrieve any loggers set with `setLoggerProvider`. It will fallback to a known list of providers. + /// + /// **Parameters** + /// * `type` - parameter of type `Type` + /// + /// **Output Type** + /// * `ILog` + let getLoggerByType (``type``: Type) = ``type`` |> string |> getLoggerByName + + /// **Description** + /// + /// Creates a logger given a `'a` type. This will attempt to retrieve any loggers set with `setLoggerProvider`. It will fallback to a known list of providers. + /// + /// **Output Type** + /// * `ILog` + /// + let getLoggerFor<'a> () = getLoggerByType (typeof<'a>) + + let rec getModuleType = + function + | PropertyGet(_, propertyInfo, _) -> propertyInfo.DeclaringType + // | Call (_, methInfo, _) -> sprintf "%s.%s" methInfo.DeclaringType.FullName methInfo.Name + // | Lambda(_, expr) -> getModuleType expr + // | ValueWithName(_,_,instance) -> instance + | x -> failwithf "Expression is not a property. %A" x + + /// **Description** + /// + /// Creates a logger given a Quotations.Expr type. This is only useful for module level declarations. It uses the DeclaringType on the PropertyInfo of the PropertyGet. + /// + /// It can be utilized like: + /// + /// `let rec logger = LogProvider.getLoggerByQuotation <@ logger @>` + /// + /// inside a module to get the modules full qualitfied name. + /// + /// **Parameters** + /// * `quotation` - parameter of type `Quotations.Expr` + /// + /// **Output Type** + /// * `ILog` + /// + /// **Exceptions** + /// + let getLoggerByQuotation (quotation: Quotations.Expr) = + getModuleType quotation |> getLoggerByType + + + + /// **Description** + /// + /// Creates a logger based on `Reflection.MethodBase.GetCurrentMethod` call. This is only useful for calls within functions. This does not protect against inlined functions. + /// + /// **Output Type** + /// * `ILog` + /// + /// **Exceptions** + /// + let inline getLoggerByFunc () = + let mi = Reflection.MethodBase.GetCurrentMethod() + sprintf "%s.%s" mi.DeclaringType.FullName mi.Name |> getLoggerByName + + + /// **Description** + /// + /// Creates a logger. It's name is based on the current StackFrame. This will attempt to retrieve any loggers set with `setLoggerProvider`. It will fallback to a known list of providers. + /// Obsolete: getCurrentLogger is obsolete, choose another provider factory function. + /// + /// **Output Type** + /// * `ILog` + [] + let getCurrentLogger () = + let stackFrame = StackFrame(2, false) + getLoggerByType (stackFrame.GetMethod().DeclaringType) diff --git a/src/FsAutoComplete.Logging/paket.references b/src/FsAutoComplete.Logging/paket.references deleted file mode 100644 index 6252aa3a0..000000000 --- a/src/FsAutoComplete.Logging/paket.references +++ /dev/null @@ -1,6 +0,0 @@ -FSharp.Core - -File: FsLibLog.fs - -Microsoft.NETFramework.ReferenceAssemblies -Ionide.KeepAChangelog.Tasks \ No newline at end of file diff --git a/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs b/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs index edae7f3ac..c56235876 100644 --- a/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs +++ b/src/FsAutoComplete/CodeFixes/AddExplicitTypeAnnotation.fs @@ -29,25 +29,25 @@ let private isPositionContainedInUntypedImplicitCtorParameter input pos = { new SyntaxVisitorBase<_>() with member _.VisitModuleDecl(_, defaultTraverse, decl) = match decl with - | SynModuleDecl.Types (typeDefns = typeDefns) -> + | SynModuleDecl.Types(typeDefns = typeDefns) -> maybe { let! ctorArgs = typeDefns |> List.tryPick (function - | SynTypeDefn(implicitConstructor = Some (SynMemberDefn.ImplicitCtor (ctorArgs = args))) when + | SynTypeDefn(implicitConstructor = Some(SynMemberDefn.ImplicitCtor(ctorArgs = args))) when rangeContainsPos args.Range pos -> Some args | _ -> None) match ctorArgs with - | SynSimplePats.SimplePats (pats = pats) -> + | SynSimplePats.SimplePats(pats = pats) -> let! pat = pats |> List.tryFind (fun pat -> rangeContainsPos pat.Range pos) let rec tryGetUntypedIdent = function - | SynSimplePat.Id (ident = ident) when rangeContainsPos ident.idRange pos -> Some ident - | SynSimplePat.Attrib (pat = pat) when rangeContainsPos pat.Range pos -> tryGetUntypedIdent pat + | SynSimplePat.Id(ident = ident) when rangeContainsPos ident.idRange pos -> Some ident + | SynSimplePat.Attrib(pat = pat) when rangeContainsPos pat.Range pos -> tryGetUntypedIdent pat | SynSimplePat.Typed _ | _ -> None @@ -94,10 +94,10 @@ let fix (getParseResultsForFile: GetParseResultsForFile) : CodeFix = match res with | None -> return [] - | Some (symbolUse, mfv, explTy) -> + | Some(symbolUse, mfv, explTy) -> match explTy.TryGetTypeAndEdits(mfv.FullType, symbolUse.DisplayContext) with | None -> return [] - | Some (_, edits) -> + | Some(_, edits) -> return [ { File = codeActionParams.TextDocument Title = title diff --git a/src/FsAutoComplete/CodeFixes/AddMissingFunKeyword.fs b/src/FsAutoComplete/CodeFixes/AddMissingFunKeyword.fs index 44d75dafd..689bc8a9a 100644 --- a/src/FsAutoComplete/CodeFixes/AddMissingFunKeyword.fs +++ b/src/FsAutoComplete/CodeFixes/AddMissingFunKeyword.fs @@ -26,8 +26,12 @@ let fix (getFileLines: GetFileLines) (getLineText: GetLineText) : CodeFix = let! line = getLineText lines - { Start = { diagnostic.Range.Start with Character = 0 } - End = { diagnostic.Range.End with Character = lineLen } } + { Start = + { diagnostic.Range.Start with + Character = 0 } + End = + { diagnostic.Range.End with + Character = lineLen } } let! prevPos = dec lines diagnostic.Range.Start diff --git a/src/FsAutoComplete/CodeFixes/AddMissingRecKeyword.fs b/src/FsAutoComplete/CodeFixes/AddMissingRecKeyword.fs index 6376a8a2e..0310e0846 100644 --- a/src/FsAutoComplete/CodeFixes/AddMissingRecKeyword.fs +++ b/src/FsAutoComplete/CodeFixes/AddMissingRecKeyword.fs @@ -42,8 +42,12 @@ let fix (getFileLines: GetFileLines) (getLineText: GetLineText) : CodeFix = let! line = getLineText lines - { Start = { diagnostic.Range.Start with Character = 0 } - End = { diagnostic.Range.End with Character = lineLen } } + { Start = + { diagnostic.Range.Start with + Character = 0 } + End = + { diagnostic.Range.End with + Character = lineLen } } match Lexer.getSymbol fcsPos.Line fcsPos.Column line SymbolLookupKind.Fuzzy [||] with | Some lexSym -> diff --git a/src/FsAutoComplete/CodeFixes/ChangeDerefBangToValue.fs b/src/FsAutoComplete/CodeFixes/ChangeDerefBangToValue.fs index a0b73f535..5cdf2f6f5 100644 --- a/src/FsAutoComplete/CodeFixes/ChangeDerefBangToValue.fs +++ b/src/FsAutoComplete/CodeFixes/ChangeDerefBangToValue.fs @@ -17,7 +17,7 @@ let private tryGetRangeOfDeref input derefPos = { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.App (_, false, SynExpr.Ident funcIdent, expr, _) -> + | SynExpr.App(_, false, SynExpr.Ident funcIdent, expr, _) -> if funcIdent.idText = "op_Dereference" && rangeContainsPos funcIdent.idRange derefPos diff --git a/src/FsAutoComplete/CodeFixes/ChangeTypeOfNameToNameOf.fs b/src/FsAutoComplete/CodeFixes/ChangeTypeOfNameToNameOf.fs index 0620e0540..53056f0c0 100644 --- a/src/FsAutoComplete/CodeFixes/ChangeTypeOfNameToNameOf.fs +++ b/src/FsAutoComplete/CodeFixes/ChangeTypeOfNameToNameOf.fs @@ -17,9 +17,9 @@ type FSharpParseFileResults with { new SyntaxVisitorBase<_>() with member _.VisitExpr(_path, _, defaultTraverse, expr) = match expr with - | SynExpr.DotGet (expr, _, _, range) -> + | SynExpr.DotGet(expr, _, _, range) -> match expr with - | SynExpr.TypeApp (SynExpr.Ident (ident), _, typeArgs, _, _, _, _) -> + | SynExpr.TypeApp(SynExpr.Ident(ident), _, typeArgs, _, _, _, _) -> let onlyOneTypeArg = match typeArgs with | [] -> false diff --git a/src/FsAutoComplete/CodeFixes/ConvertCSharpLambdaToFSharpLambda.fs b/src/FsAutoComplete/CodeFixes/ConvertCSharpLambdaToFSharpLambda.fs index e881684ff..e92f6fb65 100644 --- a/src/FsAutoComplete/CodeFixes/ConvertCSharpLambdaToFSharpLambda.fs +++ b/src/FsAutoComplete/CodeFixes/ConvertCSharpLambdaToFSharpLambda.fs @@ -19,11 +19,11 @@ let private tryRangeOfParenEnclosingOpEqualsGreaterUsage input pos = let (|InfixAppOfOpEqualsGreater|_|) = function - | SynExpr.App (ExprAtomicFlag.NonAtomic, - false, - SynExpr.App (ExprAtomicFlag.NonAtomic, true, Ident "op_EqualsGreater", actualParamListExpr, range), - actualLambdaBodyExpr, - _) -> + | SynExpr.App(ExprAtomicFlag.NonAtomic, + false, + SynExpr.App(ExprAtomicFlag.NonAtomic, true, Ident "op_EqualsGreater", actualParamListExpr, range), + actualLambdaBodyExpr, + _) -> let opEnd = range.End let opStart = Position.mkPos (range.End.Line) (range.End.Column - 2) let opRange = Range.mkRange range.FileName opStart opEnd @@ -39,12 +39,12 @@ let private tryRangeOfParenEnclosingOpEqualsGreaterUsage input pos = { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.Paren (InfixAppOfOpEqualsGreater (argsRange, opRange), _, _, _) -> Some(argsRange, opRange) + | SynExpr.Paren(InfixAppOfOpEqualsGreater(argsRange, opRange), _, _, _) -> Some(argsRange, opRange) | _ -> defaultTraverse expr member _.VisitBinding(_path, defaultTraverse, binding) = match binding with - | SynBinding (kind = SynBindingKind.Normal; expr = InfixAppOfOpEqualsGreater (argsRange, opRange)) -> + | SynBinding(kind = SynBindingKind.Normal; expr = InfixAppOfOpEqualsGreater(argsRange, opRange)) -> Some(argsRange, opRange) | _ -> defaultTraverse binding } ) @@ -62,7 +62,7 @@ let fix (getParseResultsForFile: GetParseResultsForFile) (getLineText: GetLineTe let! (tyRes, _, lines) = getParseResultsForFile fileName fcsPos match tryRangeOfParenEnclosingOpEqualsGreaterUsage tyRes.GetAST fcsPos with - | Some (argsRange, opRange) -> + | Some(argsRange, opRange) -> return [ { Title = title File = codeActionParams.TextDocument diff --git a/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs b/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs index f634afbf4..de7c949f0 100644 --- a/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs +++ b/src/FsAutoComplete/CodeFixes/ConvertPositionalDUToNamed.fs @@ -33,14 +33,14 @@ type ParseAndCheckResults with member x.TryGetPositionalUnionPattern(pos: FcsPos) = let rec (|UnionNameAndPatterns|_|) = function - | SynPat.LongIdent (longDotId = ident - argPats = SynArgPats.Pats [ SynPat.Paren (pat = SynPat.Tuple (elementPats = duFieldPatterns) - range = parenRange) ]) -> + | SynPat.LongIdent( + longDotId = ident + argPats = SynArgPats.Pats [ SynPat.Paren(pat = SynPat.Tuple(elementPats = duFieldPatterns); range = parenRange) ]) -> Some(ident, duFieldPatterns, parenRange) - | SynPat.LongIdent (longDotId = ident - argPats = SynArgPats.Pats [ SynPat.Paren (pat = singleDUFieldPattern; range = parenRange) ]) -> + | SynPat.LongIdent( + longDotId = ident; argPats = SynArgPats.Pats [ SynPat.Paren(pat = singleDUFieldPattern; range = parenRange) ]) -> Some(ident, [ singleDUFieldPattern ], parenRange) - | SynPat.Paren(pat = UnionNameAndPatterns (ident, duFieldPatterns, parenRange)) -> + | SynPat.Paren(pat = UnionNameAndPatterns(ident, duFieldPatterns, parenRange)) -> Some(ident, duFieldPatterns, parenRange) | _ -> None @@ -49,7 +49,7 @@ type ParseAndCheckResults with member x.VisitBinding(path, defaultTraverse, binding) = match binding with // DU case with multiple - | SynBinding(headPat = UnionNameAndPatterns (ident, duFieldPatterns, parenRange)) -> + | SynBinding(headPat = UnionNameAndPatterns(ident, duFieldPatterns, parenRange)) -> Some(ident, duFieldPatterns, parenRange) | _ -> defaultTraverse binding @@ -57,7 +57,7 @@ type ParseAndCheckResults with // TODO: reevaluate after https://github.com/dotnet/fsharp/pull/12837 merges member x.VisitExpr(path, traverse, defaultTraverse, expr) = match expr with - | SynExpr.Match (expr = argExpr; clauses = clauses) -> + | SynExpr.Match(expr = argExpr; clauses = clauses) -> let path = SyntaxNode.SynExpr argExpr :: path match x.VisitExpr(path, traverse, defaultTraverse, argExpr) with @@ -65,14 +65,14 @@ type ParseAndCheckResults with | None -> clauses |> List.tryPick (function - | SynMatchClause(pat = UnionNameAndPatterns (ident, duFieldPatterns, parenRange)) -> + | SynMatchClause(pat = UnionNameAndPatterns(ident, duFieldPatterns, parenRange)) -> Some(ident, duFieldPatterns, parenRange) | _ -> None) | _ -> defaultTraverse expr member x.VisitMatchClause(path, defaultTraverse, matchClause) = match matchClause with - | SynMatchClause(pat = UnionNameAndPatterns (ident, duFieldPatterns, parenRange)) -> + | SynMatchClause(pat = UnionNameAndPatterns(ident, duFieldPatterns, parenRange)) -> Some(ident, duFieldPatterns, parenRange) | _ -> defaultTraverse matchClause } @@ -167,7 +167,7 @@ let fix (getParseResultsForFile: GetParseResultsForFile) (getRangeText: GetRange match (duFields, allFieldNames) with | MatchedFields pairs -> pairs |> List.collect createEdit |> List.toArray |> Ok - | UnmatchedFields (pairs, leftover) -> + | UnmatchedFields(pairs, leftover) -> result { let! endPos = dec sourceText (fcsPosToLsp parenRange.End) diff --git a/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs b/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs index d607505b6..b38381978 100644 --- a/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs +++ b/src/FsAutoComplete/CodeFixes/ExternalSystemDiagnostics.fs @@ -19,7 +19,7 @@ let private mapExternalDiagnostic diagnosticType = | None -> AsyncResult.retn [] | Some fixes -> match fixes with - | Payload (fixes: list) -> + | Payload(fixes: list) -> AsyncResult.retn [ { SourceDiagnostic = Some diagnostic File = codeActionParams.TextDocument diff --git a/src/FsAutoComplete/CodeFixes/GenerateAbstractClassStub.fs b/src/FsAutoComplete/CodeFixes/GenerateAbstractClassStub.fs index 65f71597b..def41f966 100644 --- a/src/FsAutoComplete/CodeFixes/GenerateAbstractClassStub.fs +++ b/src/FsAutoComplete/CodeFixes/GenerateAbstractClassStub.fs @@ -28,12 +28,12 @@ let fix let! (tyRes, line, lines) = getParseResultsForFile fileName fcsRange.Start match! genAbstractClassStub tyRes fcsRange lines line with - | CoreResponse.Res (text, position) -> + | CoreResponse.Res(text, position) -> let replacements = getTextReplacements () let replaced = (text, replacements) - ||> Seq.fold (fun text (KeyValue (key, replacement)) -> text.Replace(key, replacement)) + ||> Seq.fold (fun text (KeyValue(key, replacement)) -> text.Replace(key, replacement)) return [ { SourceDiagnostic = Some diagnostic diff --git a/src/FsAutoComplete/CodeFixes/GenerateRecordStub.fs b/src/FsAutoComplete/CodeFixes/GenerateRecordStub.fs index 4189c96d0..81d28915a 100644 --- a/src/FsAutoComplete/CodeFixes/GenerateRecordStub.fs +++ b/src/FsAutoComplete/CodeFixes/GenerateRecordStub.fs @@ -23,12 +23,12 @@ let fix let! (tyRes, line, lines) = getParseResultsForFile fileName pos match! genRecordStub tyRes pos lines line with - | CoreResponse.Res (text, position) -> + | CoreResponse.Res(text, position) -> let replacements = getTextReplacements () let replaced = (text, replacements) - ||> Seq.fold (fun text (KeyValue (key, replacement)) -> text.Replace(key, replacement)) + ||> Seq.fold (fun text (KeyValue(key, replacement)) -> text.Replace(key, replacement)) return [ { SourceDiagnostic = None diff --git a/src/FsAutoComplete/CodeFixes/GenerateUnionCases.fs b/src/FsAutoComplete/CodeFixes/GenerateUnionCases.fs index 3908256f5..82fd6a162 100644 --- a/src/FsAutoComplete/CodeFixes/GenerateUnionCases.fs +++ b/src/FsAutoComplete/CodeFixes/GenerateUnionCases.fs @@ -40,7 +40,7 @@ let fix let! (tyRes, line, lines) = getParseResultsForFile fileName casePosFCS match! generateCases tyRes casePosFCS lines line |> Async.map Ok with - | CoreResponse.Res (insertString: string, insertPosition) -> + | CoreResponse.Res(insertString: string, insertPosition) -> let range = { Start = fcsPosToLsp insertPosition End = fcsPosToLsp insertPosition } @@ -49,7 +49,7 @@ let fix let replaced = (insertString, replacements) - ||> Seq.fold (fun text (KeyValue (key, replacement)) -> text.Replace(key, replacement)) + ||> Seq.fold (fun text (KeyValue(key, replacement)) -> text.Replace(key, replacement)) return [ { SourceDiagnostic = Some diagnostic diff --git a/src/FsAutoComplete/CodeFixes/ImplementInterface.fs b/src/FsAutoComplete/CodeFixes/ImplementInterface.fs index 2f650155f..2c6d4259e 100644 --- a/src/FsAutoComplete/CodeFixes/ImplementInterface.fs +++ b/src/FsAutoComplete/CodeFixes/ImplementInterface.fs @@ -20,9 +20,9 @@ let private tryFindInterfaceDeclarationInObjectExpression (pos: Position) (ast: { new SyntaxVisitorBase<_>() with member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with - | SynExpr.ObjExpr (objType = ty; bindings = binds; extraImpls = ifaces) -> + | SynExpr.ObjExpr(objType = ty; bindings = binds; extraImpls = ifaces) -> ifaces - |> List.tryPick (fun (SynInterfaceImpl (interfaceTy = ty; bindings = binds; range = range)) -> + |> List.tryPick (fun (SynInterfaceImpl(interfaceTy = ty; bindings = binds; range = range)) -> if Range.rangeContainsPos range pos then Some(InterfaceData.ObjExpr(ty, binds)) else @@ -50,7 +50,7 @@ let private tryFindInterfaceStartAndWith (pos: Position) (ast: ParsedInput) = member _.VisitExpr(_, _, defaultTraverse, expr) = match expr with // main interface - | SynExpr.ObjExpr (objType = ty; withKeyword = withRange; newExprRange = startingAtNewRange) when + | SynExpr.ObjExpr(objType = ty; withKeyword = withRange; newExprRange = startingAtNewRange) when Range.rangeContainsPos ty.Range pos -> // { new IDisposable with } @@ -58,10 +58,10 @@ let private tryFindInterfaceStartAndWith (pos: Position) (ast: ParsedInput) = let start = startingAtNewRange.Start Some(start, withRange) // secondary interface - | SynExpr.ObjExpr (extraImpls = ifaces) -> + | SynExpr.ObjExpr(extraImpls = ifaces) -> ifaces |> List.tryPick - (fun (SynInterfaceImpl (interfaceTy = ty; withKeyword = withRange; range = startingAtInterfaceRange)) -> + (fun (SynInterfaceImpl(interfaceTy = ty; withKeyword = withRange; range = startingAtInterfaceRange)) -> if Range.rangeContainsPos ty.Range pos then // { new IDisposable with // member this.Dispose() = () @@ -77,17 +77,17 @@ let private tryFindInterfaceStartAndWith (pos: Position) (ast: ParsedInput) = member _.VisitModuleDecl(_, defaultTraverse, synModuleDecl) = match synModuleDecl with - | SynModuleDecl.Types (typeDefns, _) -> + | SynModuleDecl.Types(typeDefns, _) -> let typeDefn = typeDefns |> List.tryFind (fun typeDef -> Range.rangeContainsPos typeDef.Range pos) match typeDefn with - | Some (SynTypeDefn (typeRepr = typeRepr; members = members)) -> + | Some(SynTypeDefn(typeRepr = typeRepr; members = members)) -> let tryFindInMemberDefns (members: SynMemberDefns) = members |> List.tryPick (function - | SynMemberDefn.Interface (interfaceType = ty; withKeyword = withRange; range = range) when + | SynMemberDefn.Interface(interfaceType = ty; withKeyword = withRange; range = range) when Range.rangeContainsPos ty.Range pos -> // interface IDisposable with @@ -97,7 +97,7 @@ let private tryFindInterfaceStartAndWith (pos: Position) (ast: ParsedInput) = | _ -> None) match typeRepr with - | SynTypeDefnRepr.ObjectModel (members = members) -> + | SynTypeDefnRepr.ObjectModel(members = members) -> // in class (-> in typeRepr) tryFindInMemberDefns members | _ -> None @@ -127,20 +127,18 @@ let private tryFindInsertionData (interfaceData: InterfaceData) (ast: ParsedInpu let lastExistingMember = match interfaceData with - | InterfaceData.Interface (_, None) -> None - | InterfaceData.Interface (_, Some memberDefns) -> + | InterfaceData.Interface(_, None) -> None + | InterfaceData.Interface(_, Some memberDefns) -> memberDefns |> List.choose (function - | SynMemberDefn.Member (memberDefn = binding) -> Some binding + | SynMemberDefn.Member(memberDefn = binding) -> Some binding | _ -> None) |> List.tryLast - | InterfaceData.ObjExpr (_, bindings) -> bindings |> List.tryLast + | InterfaceData.ObjExpr(_, bindings) -> bindings |> List.tryLast match lastExistingMember with - | Some (SynBinding (attributes = attributes - valData = SynValData (memberFlags = memberFlags) - headPat = headPat - expr = expr)) -> + | Some(SynBinding( + attributes = attributes; valData = SynValData(memberFlags = memberFlags); headPat = headPat; expr = expr)) -> // align with existing member // insert after last member @@ -199,15 +197,15 @@ let private tryFindInsertionData (interfaceData: InterfaceData) (ast: ParsedInpu |> List.map (fun r -> r.StartColumn) // List.tryMin |> List.fold - (fun m c -> - match m with - | None -> Some c - | Some m -> min c m |> Some) - None + (fun m c -> + match m with + | None -> Some c + | Some m -> min c m |> Some) + None | None -> None) |> Option.defaultValue - // fallback: start of head pat (should not happen -> always `member`) - headPat.Range.StartColumn + // fallback: start of head pat (should not happen -> always `member`) + headPat.Range.StartColumn let insertPos = expr.Range.End @@ -221,7 +219,7 @@ let private tryFindInsertionData (interfaceData: InterfaceData) (ast: ParsedInpu // insert after `with` or identifier match tryFindInterfaceStartAndWith interfaceData.Range.End ast with | None -> None - | Some (startPos, withRange) -> + | Some(startPos, withRange) -> let startCol = startPos.Column + indentationSize let insertPos = @@ -271,8 +269,8 @@ let fix /// End of Interface identifier let ifacePos = match interfaceData with - | InterfaceData.ObjExpr (ty, _) -> ty.Range.End - | InterfaceData.Interface (ty, _) -> ty.Range.End + | InterfaceData.ObjExpr(ty, _) -> ty.Range.End + | InterfaceData.Interface(ty, _) -> ty.Range.End // line might be different -> update // (for example when `{` not on same line as main interface name) let! line = diff --git a/src/FsAutoComplete/CodeFixes/RemoveUnusedBinding.fs b/src/FsAutoComplete/CodeFixes/RemoveUnusedBinding.fs index 5ceed6dee..97fb9c5ef 100644 --- a/src/FsAutoComplete/CodeFixes/RemoveUnusedBinding.fs +++ b/src/FsAutoComplete/CodeFixes/RemoveUnusedBinding.fs @@ -35,7 +35,7 @@ type FSharpParseFileResults with Some(Pattern diagnosticRange) else match pat with - | SynPat.Paren (inner, m) -> + | SynPat.Paren(inner, m) -> // otherwise if the pattern inside a parens if Range.rangeContainsRange m diagnosticRange then // explicitly matches @@ -52,7 +52,7 @@ type FSharpParseFileResults with override _.VisitBinding(_, defaultTraverse, binding) = match binding with - | SynBinding (kind = SynBindingKind.Normal; headPat = pat) as binding -> + | SynBinding(kind = SynBindingKind.Normal; headPat = pat) as binding -> // walk the patterns in the binding first, to allow the parameter traversal a chance to fire match defaultTraverse binding with | None -> @@ -62,7 +62,7 @@ type FSharpParseFileResults with else // Check if it's an operator match pat with - | SynPat.LongIdent(longDotId = LongIdentWithDots ([ id ], _)) when id.idText.StartsWith("op_") -> + | SynPat.LongIdent(longDotId = LongIdentWithDots([ id ], _)) when id.idText.StartsWith("op_") -> if Range.rangeContainsRange id.idRange diagnosticRange then Some(FullBinding binding.RangeOfBindingWithRhs) else diff --git a/src/FsAutoComplete/CodeFixes/RenameUnusedValue.fs b/src/FsAutoComplete/CodeFixes/RenameUnusedValue.fs index d46509a60..d6eb69f42 100644 --- a/src/FsAutoComplete/CodeFixes/RenameUnusedValue.fs +++ b/src/FsAutoComplete/CodeFixes/RenameUnusedValue.fs @@ -25,7 +25,7 @@ let private variableHasAccessibility (ast: ParsedInput) (pos: Position) = { new SyntaxVisitorBase<_>() with member _.VisitPat(_, defaultTraverse, pat) = match pat with - | SynPat.Named (accessibility = Some _; range = range) when Range.rangeContainsPos range pos -> + | SynPat.Named(accessibility = Some _; range = range) when Range.rangeContainsPos range pos -> // `SynAccess` in FCS version currently used in FSAC doesn't contain its range // -> no easy way to get range with accessibility // -> instead of returning range with accessibility, just info if there's accessibility diff --git a/src/FsAutoComplete/CodeFixes/ResolveNamespace.fs b/src/FsAutoComplete/CodeFixes/ResolveNamespace.fs index a76bdff02..3babcc543 100644 --- a/src/FsAutoComplete/CodeFixes/ResolveNamespace.fs +++ b/src/FsAutoComplete/CodeFixes/ResolveNamespace.fs @@ -14,10 +14,11 @@ type LineText = string /// a codefix the provides suggestions for opening modules or using qualified names when an identifier is found that needs qualification let fix (getParseResultsForFile: GetParseResultsForFile) - (getNamespaceSuggestions: ParseAndCheckResults - -> FcsPos - -> LineText - -> Async * list>>) + (getNamespaceSuggestions: + ParseAndCheckResults + -> FcsPos + -> LineText + -> Async * list>>) = /// insert a line of text at a given line @@ -110,7 +111,7 @@ let fix match! getNamespaceSuggestions tyRes pos line with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> return [] - | CoreResponse.Res (word, opens, qualifiers) -> + | CoreResponse.Res(word, opens, qualifiers) -> let quals = qualifiers |> List.map (fun (_, qual) -> qualifierFix codeActionParameter.TextDocument diagnostic qual) diff --git a/src/FsAutoComplete/CommandResponse.fs b/src/FsAutoComplete/CommandResponse.fs index e0f856c90..721fa24f5 100644 --- a/src/FsAutoComplete/CommandResponse.fs +++ b/src/FsAutoComplete/CommandResponse.fs @@ -350,7 +350,7 @@ module CommandResponse = let mapItemResponse (p: Ionide.ProjInfo.ProjectViewerItem) : ProjectResponseItem = match p with - | Ionide.ProjInfo.ProjectViewerItem.Compile (fullpath, extraInfo) -> + | Ionide.ProjInfo.ProjectViewerItem.Compile(fullpath, extraInfo) -> { ProjectResponseItem.Name = "Compile" ProjectResponseItem.FilePath = fullpath ProjectResponseItem.VirtualPath = extraInfo.Link @@ -389,15 +389,15 @@ module CommandResponse = let projectError (serialize: Serializer) errorDetails = let rec getMessageLines errorDetails = match errorDetails with - | Ionide.ProjInfo.Types.ProjectNotFound (_) -> [ "couldn't find project" ] - | Ionide.ProjInfo.Types.LanguageNotSupported (_) -> [ sprintf "this project is not supported, only fsproj" ] - | Ionide.ProjInfo.Types.ProjectNotLoaded (_) -> + | Ionide.ProjInfo.Types.ProjectNotFound(_) -> [ "couldn't find project" ] + | Ionide.ProjInfo.Types.LanguageNotSupported(_) -> [ sprintf "this project is not supported, only fsproj" ] + | Ionide.ProjInfo.Types.ProjectNotLoaded(_) -> [ sprintf "this project was not loaded due to some internal error" ] | Ionide.ProjInfo.Types.MissingExtraProjectInfos _ -> [ sprintf "this project was not loaded because ExtraProjectInfos were missing" ] - | Ionide.ProjInfo.Types.InvalidExtraProjectInfos (_, err) -> + | Ionide.ProjInfo.Types.InvalidExtraProjectInfos(_, err) -> [ sprintf "this project was not loaded because ExtraProjectInfos were invalid: %s" err ] - | Ionide.ProjInfo.Types.ReferencesNotLoaded (_, referenceErrors) -> + | Ionide.ProjInfo.Types.ReferencesNotLoaded(_, referenceErrors) -> [ yield sprintf "this project was not loaded because some references could not be loaded:" yield! @@ -405,25 +405,25 @@ module CommandResponse = |> Seq.collect (fun (projPath, er) -> [ yield sprintf " - %s:" projPath yield! getMessageLines er |> Seq.map (fun line -> sprintf " - %s" line) ]) ] - | Ionide.ProjInfo.Types.GenericError (_, errorMessage) -> [ errorMessage ] + | Ionide.ProjInfo.Types.GenericError(_, errorMessage) -> [ errorMessage ] | Ionide.ProjInfo.Types.ProjectNotRestored _ -> [ "Project not restored" ] let msg = getMessageLines errorDetails |> String.concat Environment.NewLine match errorDetails with - | Ionide.ProjInfo.Types.ProjectNotFound (project) -> + | Ionide.ProjInfo.Types.ProjectNotFound(project) -> errorG serialize (ErrorData.GenericProjectError { Project = project }) msg - | Ionide.ProjInfo.Types.LanguageNotSupported (project) -> + | Ionide.ProjInfo.Types.LanguageNotSupported(project) -> errorG serialize (ErrorData.GenericProjectError { Project = project }) msg | Ionide.ProjInfo.Types.ProjectNotLoaded project -> errorG serialize (ErrorData.GenericProjectError { Project = project }) msg | Ionide.ProjInfo.Types.MissingExtraProjectInfos project -> errorG serialize (ErrorData.GenericProjectError { Project = project }) msg - | Ionide.ProjInfo.Types.InvalidExtraProjectInfos (project, _) -> + | Ionide.ProjInfo.Types.InvalidExtraProjectInfos(project, _) -> errorG serialize (ErrorData.GenericProjectError { Project = project }) msg - | Ionide.ProjInfo.Types.ReferencesNotLoaded (project, _) -> + | Ionide.ProjInfo.Types.ReferencesNotLoaded(project, _) -> errorG serialize (ErrorData.GenericProjectError { Project = project }) msg - | Ionide.ProjInfo.Types.GenericError (project, _) -> + | Ionide.ProjInfo.Types.GenericError(project, _) -> errorG serialize (ErrorData.ProjectParsingFailed { Project = project }) msg | Ionide.ProjInfo.Types.ProjectNotRestored project -> errorG serialize (ErrorData.ProjectNotRestored { Project = project }) msg @@ -436,11 +436,11 @@ module CommandResponse = let workspacePeek (serialize: Serializer) (found: WorkspacePeek.Interesting list) = let mapInt i = match i with - | WorkspacePeek.Interesting.Directory (p, fsprojs) -> + | WorkspacePeek.Interesting.Directory(p, fsprojs) -> WorkspacePeekFound.Directory { WorkspacePeekFoundDirectory.Directory = p Fsprojs = fsprojs } - | WorkspacePeek.Interesting.Solution (p, sd) -> + | WorkspacePeek.Interesting.Solution(p, sd) -> let rec item (x: Ionide.ProjInfo.InspectSln.SolutionItem) = let kind = match x.Kind with @@ -451,7 +451,7 @@ module CommandResponse = WorkspacePeekFoundSolutionItemKind.MsbuildFormat { WorkspacePeekFoundSolutionItemKindMsbuildFormat.Configurations = [] } ) - | Ionide.ProjInfo.InspectSln.SolutionItemKind.Folder (children, files) -> + | Ionide.ProjInfo.InspectSln.SolutionItemKind.Folder(children, files) -> let c = children |> List.choose item Some( @@ -561,7 +561,7 @@ module CommandResponse = Signature = n Comment = m }) ) - | _, Some (xml, assembly) -> + | _, Some(xml, assembly) -> TipFormatter.formatDocumentationFromXmlSig xml assembly signature footer cn |> List.map ( List.map (fun (n, cns, fds, funcs, intf, attrs, ts, m, f, cn) -> diff --git a/src/FsAutoComplete/FsAutoComplete.fsproj b/src/FsAutoComplete/FsAutoComplete.fsproj index 57e1558a6..cf2c76360 100644 --- a/src/FsAutoComplete/FsAutoComplete.fsproj +++ b/src/FsAutoComplete/FsAutoComplete.fsproj @@ -38,6 +38,16 @@ + + + + + + + + + + fsautocomplete fsautocomplete @@ -53,10 +63,8 @@ - + - - diff --git a/src/FsAutoComplete/JsonSerializer.fs b/src/FsAutoComplete/JsonSerializer.fs index d16f24529..b2584f010 100644 --- a/src/FsAutoComplete/JsonSerializer.fs +++ b/src/FsAutoComplete/JsonSerializer.fs @@ -94,7 +94,7 @@ module private JsonSerializerConverters = match value with | CommandResponse.ProjectOutputType.Library -> "lib" | CommandResponse.ProjectOutputType.Exe -> "exe" - | CommandResponse.ProjectOutputType.Custom (x) -> x.ToLower() + | CommandResponse.ProjectOutputType.Custom(x) -> x.ToLower() serializer.Serialize(writer, s) diff --git a/src/FsAutoComplete/LspHelpers.fs b/src/FsAutoComplete/LspHelpers.fs index 222a30f93..5f51c3d56 100644 --- a/src/FsAutoComplete/LspHelpers.fs +++ b/src/FsAutoComplete/LspHelpers.fs @@ -286,11 +286,11 @@ module Workspace = let mapInteresting i = match i with - | Interesting.Directory (p, fsprojs) -> + | Interesting.Directory(p, fsprojs) -> WorkspacePeekFound.Directory { WorkspacePeekFoundDirectory.Directory = p Fsprojs = fsprojs } - | Interesting.Solution (p, sd) -> + | Interesting.Solution(p, sd) -> let rec item (x: Ionide.ProjInfo.InspectSln.SolutionItem) = let kind = match x.Kind with @@ -301,7 +301,7 @@ module Workspace = WorkspacePeekFoundSolutionItemKind.MsbuildFormat { WorkspacePeekFoundSolutionItemKindMsbuildFormat.Configurations = [] } ) - | Ionide.ProjInfo.InspectSln.SolutionItemKind.Folder (children, files) -> + | Ionide.ProjInfo.InspectSln.SolutionItemKind.Folder(children, files) -> let c = children |> List.choose item Some( @@ -935,7 +935,10 @@ let createTokenLegend<'types, 'modifiers /// /// let encodeSemanticHighlightRanges - (rangesAndHighlights: (struct (Ionide.LanguageServerProtocol.Types.Range * ClassificationUtils.SemanticTokenTypes * ClassificationUtils.SemanticTokenModifier list)) array) + (rangesAndHighlights: + (struct (Ionide.LanguageServerProtocol.Types.Range * + ClassificationUtils.SemanticTokenTypes * + ClassificationUtils.SemanticTokenModifier list)) array) = let fileStart = { Start = { Line = 0; Character = 0 } @@ -943,7 +946,10 @@ let encodeSemanticHighlightRanges let computeLine (prev: Ionide.LanguageServerProtocol.Types.Range) - ((range, ty, mods): struct (Ionide.LanguageServerProtocol.Types.Range * ClassificationUtils.SemanticTokenTypes * ClassificationUtils.SemanticTokenModifier list)) + ((range, ty, mods): + struct (Ionide.LanguageServerProtocol.Types.Range * + ClassificationUtils.SemanticTokenTypes * + ClassificationUtils.SemanticTokenModifier list)) : uint32[] = let lineDelta = if prev.Start.Line = range.Start.Line then diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index 94e7ca004..d443b721b 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -64,16 +64,13 @@ module AdaptiveExtensions = module Utils = let cheapEqual (a: 'T) (b: 'T) = - ShallowEqualityComparer<'T>.Instance.Equals (a, b) + ShallowEqualityComparer<'T>.Instance.Equals(a, b) /// /// Maps and calls dispose before mapping of new values. Useful for cleaning up callbacks like AddMarkingCallback for tracing purposes. /// type MapDisposableTupleVal<'T1, 'T2, 'Disposable when 'Disposable :> IDisposable> - ( - mapping: 'T1 -> ('T2 * 'Disposable), - input: aval<'T1> - ) = + (mapping: 'T1 -> ('T2 * 'Disposable), input: aval<'T1>) = inherit AVal.AbstractVal<'T2>() let mutable cache: ValueOption = ValueNone @@ -82,8 +79,8 @@ type MapDisposableTupleVal<'T1, 'T2, 'Disposable when 'Disposable :> IDisposable let i = input.GetValue token match cache with - | ValueSome (struct (a, b, _)) when Utils.cheapEqual a i -> b - | ValueSome (struct (a, b, c)) -> + | ValueSome(struct (a, b, _)) when Utils.cheapEqual a i -> b + | ValueSome(struct (a, b, c)) -> (c :> IDisposable).Dispose() let (b, c) = mapping i cache <- ValueSome(struct (i, b, c)) @@ -120,10 +117,10 @@ module AVal = for op in HashSet.computeDelta lastDeps newDeps do match op with - | Add (_, d) -> + | Add(_, d) -> // the new dependency needs to be evaluated with our token, s.t. we depend on it in the future d.GetValueUntyped token |> ignore - | Rem (_, d) -> + | Rem(_, d) -> // we no longer need to depend on the old dependency so we can remove ourselves from its outputs lock d.Outputs (fun () -> d.Outputs.Remove x) |> ignore @@ -252,24 +249,24 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let ws = match ws with - | ProjectResponse.Project (x, _) -> CommandResponse.project JsonSerializer.writeJson x - | ProjectResponse.ProjectError (_, errorDetails) -> + | ProjectResponse.Project(x, _) -> CommandResponse.project JsonSerializer.writeJson x + | ProjectResponse.ProjectError(_, errorDetails) -> CommandResponse.projectError JsonSerializer.writeJson errorDetails - | ProjectResponse.ProjectLoading (projectFileName) -> + | ProjectResponse.ProjectLoading(projectFileName) -> CommandResponse.projectLoading JsonSerializer.writeJson projectFileName - | ProjectResponse.WorkspaceLoad (finished) -> + | ProjectResponse.WorkspaceLoad(finished) -> CommandResponse.workspaceLoad JsonSerializer.writeJson finished - | ProjectResponse.ProjectChanged (projectFileName) -> failwith "Not Implemented" + | ProjectResponse.ProjectChanged(projectFileName) -> failwith "Not Implemented" logger.info (Log.setMessage "Workspace Notify {ws}" >> Log.addContextDestructured "ws" ws) do! ({ Content = ws }: PlainNotification) |> lspClient.NotifyWorkspace - | NotificationEvent.ParseError (errors, file) -> + | NotificationEvent.ParseError(errors, file) -> let uri = Path.LocalPathToUri file let diags = errors |> Array.map fcsErrorToDiagnostic diagnosticCollections.SetFor(uri, "F# Compiler", diags) - | NotificationEvent.UnusedOpens (file, opens) -> + | NotificationEvent.UnusedOpens(file, opens) -> let uri = Path.LocalPathToUri file let diags = @@ -287,7 +284,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar diagnosticCollections.SetFor(uri, "F# Unused opens", diags) - | NotificationEvent.UnusedDeclarations (file, decls) -> + | NotificationEvent.UnusedDeclarations(file, decls) -> let uri = Path.LocalPathToUri file let diags = @@ -305,14 +302,15 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar diagnosticCollections.SetFor(uri, "F# Unused declarations", diags) - | NotificationEvent.SimplifyNames (file, decls) -> + | NotificationEvent.SimplifyNames(file, decls) -> let uri = Path.LocalPathToUri file let diags = decls |> Array.map - (fun ({ Range = range + (fun + ({ Range = range RelativeName = _relName }) -> { Diagnostic.Range = fcsRangeToLsp range Code = Some "FSAC0002" @@ -365,11 +363,11 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar // |> List.toArray // diagnosticCollections.SetFor(uri, "F# Linter", diags) - | NotificationEvent.Canceled (msg) -> + | NotificationEvent.Canceled(msg) -> let ntf: PlainNotification = { Content = msg } do! lspClient.NotifyCancelledRequest ntf - | NotificationEvent.AnalyzerMessage (messages, file) -> + | NotificationEvent.AnalyzerMessage(messages, file) -> let uri = Path.LocalPathToUri file match messages with @@ -408,7 +406,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar Data = fixes }) diagnosticCollections.SetFor(uri, "F# Analyzers", diags) - | NotificationEvent.TestDetected (file, tests) -> + | NotificationEvent.TestDetected(file, tests) -> let rec map (r: TestAdapter.TestAdapterEntry) : TestAdapter.TestAdapterEntry = @@ -578,9 +576,9 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let responseFiles = projViewerItemsNormalized.Items |> List.map (function - | ProjectViewerItem.Compile (p, c) -> ProjectViewerItem.Compile(Helpers.fullPathNormalized p, c)) + | ProjectViewerItem.Compile(p, c) -> ProjectViewerItem.Compile(Helpers.fullPathNormalized p, c)) |> List.choose (function - | ProjectViewerItem.Compile (p, _) -> Some p) + | ProjectViewerItem.Compile(p, _) -> Some p) let references = FscArguments.references (opts.OtherOptions |> List.ofArray) @@ -710,7 +708,12 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar |> AMap.tryFind file |> AVal.bind (Option.defaultValue (AVal.constant [])) - let autoCompleteItems: cmap * (Position -> option) * FSharp.Compiler.Syntax.ParsedInput> = + let autoCompleteItems + : cmap * + (Position -> option) * + FSharp.Compiler.Syntax.ParsedInput> = cmap () let getAutoCompleteByDeclName name = autoCompleteItems |> AMap.tryFind name @@ -848,7 +851,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let config = config |> AVal.force match findFileInOpenFiles f |> AVal.force, getProjectOptionsForFile f |> AVal.force |> List.tryHead with - | Some (fileInfo, _), Some (opts) -> return! parseAndCheckFile checker fileInfo opts config |> Async.Ignore + | Some(fileInfo, _), Some(opts) -> return! parseAndCheckFile checker fileInfo opts config |> Async.Ignore | _, _ -> () } @@ -866,10 +869,10 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar return Debug.measure "parseFile" <| fun () -> - let opts = Utils.projectOptionsToParseOptions opts + let opts = Utils.projectOptionsToParseOptions opts - checker.ParseFile(file, info.Lines, opts) - |> Async.RunSynchronouslyWithCTSafe(fun () -> cts.Token) + checker.ParseFile(file, info.Lines, opts) + |> Async.RunSynchronouslyWithCTSafe(fun () -> cts.Token) | None -> return None }) @@ -883,7 +886,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar and! projectOptions = getProjectOptionsForFile file match List.tryHead projectOptions with - | Some (opts) -> + | Some(opts) -> let parseAndCheck = checker.TryGetRecentCheckResultsForFile(file, opts, info.Lines) return parseAndCheck @@ -900,12 +903,12 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar and! config = config match List.tryHead projectOptions with - | Some (opts) -> + | Some(opts) -> let parseAndCheck = Debug.measure "parseAndCheckFile" <| fun () -> - parseAndCheckFile checker info opts config - |> Async.RunSynchronouslyWithCTSafe(fun () -> cts.Token) + parseAndCheckFile checker info opts config + |> Async.RunSynchronouslyWithCTSafe(fun () -> cts.Token) return parseAndCheck | None -> return None @@ -1278,11 +1281,11 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let rootPath = rootPath |> AVal.force match res with - | (FormatDocumentResponse.Formatted (lines, formatted)) -> + | (FormatDocumentResponse.Formatted(lines, formatted)) -> let result = handlerFormattedDoc (lines, formatted) return (Some(result)) - | (FormatDocumentResponse.FormattedRange (lines, formatted, range)) -> + | (FormatDocumentResponse.FormattedRange(lines, formatted, range)) -> let result = handleFormattedRange (lines, formatted, range) return (Some(result)) @@ -1318,9 +1321,10 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar if not (File.Exists dotConfig) then let! result = - Cli.Wrap("dotnet").WithArguments("new tool-manifest").WithWorkingDirectory( - rootPath - ) + Cli + .Wrap("dotnet") + .WithArguments("new tool-manifest") + .WithWorkingDirectory(rootPath) .ExecuteBufferedAsync() .Task |> Async.AwaitTask @@ -1335,9 +1339,10 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar if dotConfigContent.Contains("fantomas") then // uninstall a older, non-compatible version of fantomas let! result = - Cli.Wrap("dotnet").WithArguments("tool uninstall fantomas").WithWorkingDirectory( - rootPath - ) + Cli + .Wrap("dotnet") + .WithArguments("tool uninstall fantomas") + .WithWorkingDirectory(rootPath) .ExecuteBufferedAsync() .Task |> Async.AwaitTask @@ -1350,9 +1355,10 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar ) let! result = - Cli.Wrap("dotnet").WithArguments("tool install fantomas").WithWorkingDirectory( - rootPath - ) + Cli + .Wrap("dotnet") + .WithArguments("tool install fantomas") + .WithWorkingDirectory(rootPath) .ExecuteBufferedAsync() .Task |> Async.AwaitTask @@ -1376,9 +1382,9 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar |> Option.defaultValue (async { return () }) | (Some { Title = "Install globally" }) -> let! result = - Cli.Wrap("dotnet").WithArguments( - "tool install -g fantomas" - ) + Cli + .Wrap("dotnet") + .WithArguments("tool install -g fantomas") .ExecuteBufferedAsync() .Task |> Async.AwaitTask @@ -1721,7 +1727,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar typeCheckResults.TryGetCompletions pos lineStr None getAllSymbols) with | None -> return None - | Some (decls, residue, shouldKeywords) -> + | Some(decls, residue, shouldKeywords) -> return Some(decls, residue, shouldKeywords, typeCheckResults, getAllSymbols) } @@ -1730,51 +1736,51 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar |> AsyncResult.ofStringErr with | None -> return! success (Some completionList) - | Some (decls, residue, shouldKeywords, typeCheckResults, getAllSymbols) -> + | Some(decls, residue, shouldKeywords, typeCheckResults, getAllSymbols) -> return! Debug.measure "TextDocumentCompletion.TryGetCompletions success" <| fun () -> - transact (fun () -> - HashMap.OfList( - [ for d in decls do - d.Name, (d, pos, filePath, namedText.Lines.GetLine, typeCheckResults.GetAST) ] - ) - |> autoCompleteItems.UpdateTo) - |> ignore - - let includeKeywords = config.KeywordsAutocomplete && shouldKeywords - - let items = - decls - |> Array.mapi (fun id d -> - let code = - if System.Text.RegularExpressions.Regex.IsMatch(d.Name, """^[a-zA-Z][a-zA-Z0-9']+$""") then - d.Name - elif d.NamespaceToOpen.IsSome then - d.Name - else - FSharpKeywords.AddBackticksToIdentifierIfNeeded d.Name - - let label = - match d.NamespaceToOpen with - | Some no -> sprintf "%s (open %s)" d.Name no - | None -> d.Name - - { CompletionItem.Create(d.Name) with - Kind = (AVal.force glyphToCompletionKind) d.Glyph - InsertText = Some code - SortText = Some(sprintf "%06d" id) - FilterText = Some d.Name }) - - let its = - if not includeKeywords then - items - else - Array.append items KeywordList.keywordCompletionItems - - let completionList = { IsIncomplete = false; Items = its } - success (Some completionList) + transact (fun () -> + HashMap.OfList( + [ for d in decls do + d.Name, (d, pos, filePath, namedText.Lines.GetLine, typeCheckResults.GetAST) ] + ) + |> autoCompleteItems.UpdateTo) + |> ignore + + let includeKeywords = config.KeywordsAutocomplete && shouldKeywords + + let items = + decls + |> Array.mapi (fun id d -> + let code = + if System.Text.RegularExpressions.Regex.IsMatch(d.Name, """^[a-zA-Z][a-zA-Z0-9']+$""") then + d.Name + elif d.NamespaceToOpen.IsSome then + d.Name + else + FSharpKeywords.AddBackticksToIdentifierIfNeeded d.Name + + let label = + match d.NamespaceToOpen with + | Some no -> sprintf "%s (open %s)" d.Name no + | None -> d.Name + + { CompletionItem.Create(d.Name) with + Kind = (AVal.force glyphToCompletionKind) d.Glyph + InsertText = Some code + SortText = Some(sprintf "%06d" id) + FilterText = Some d.Name }) + + let its = + if not includeKeywords then + items + else + Array.append items KeywordList.keywordCompletionItems + + let completionList = { IsIncomplete = false; Items = its } + success (Some completionList) with e -> logger.error ( @@ -1789,13 +1795,13 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar override __.CompletionItemResolve(ci: CompletionItem) = let mapHelpText (ci: CompletionItem) (text: HelpText) = match text with - | HelpText.Simple (symbolName, text) -> + | HelpText.Simple(symbolName, text) -> let d = Documentation.Markup(markdown text) { ci with Detail = Some symbolName Documentation = Some d } - | HelpText.Full (name, tip, additionalEdit) -> + | HelpText.Full(name, tip, additionalEdit) -> let (si, comment) = TipFormatter.formatCompletionItemTip tip let edits, label = @@ -1806,7 +1812,9 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let indentation = String(' ', fcsPos.Column) $"{indentation}open {ns}\n" - let insertPos = { (fcsPos |> fcsPosToLsp) with Character = 0 } + let insertPos = + { (fcsPos |> fcsPosToLsp) with + Character = 0 } Some [| { TextEdit.NewText = text @@ -1839,7 +1847,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar match getAutoCompleteByDeclName sym |> AVal.force with | None -> //Isn't in sync filled cache, we don't have result CoreResponse.ErrorRes(sprintf "No help text available for symbol '%s'" sym) - | Some (decl, pos, fn, _, _) -> //Is in sync filled cache, try to get results from async filled caches or calculate if it's not there + | Some(decl, pos, fn, _, _) -> //Is in sync filled cache, try to get results from async filled caches or calculate if it's not there let tip = decl.Description @@ -1864,7 +1872,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar | Some insertText -> helpText insertText |> Result.ofCoreResponse - |> Result.fold (mapHelpText ci) (fun _ -> ci) + |> Result.bimap (mapHelpText ci) (fun _ -> ci) |> success with e -> @@ -1951,7 +1959,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let! tyRes = forceGetTypeCheckResults filePath |> Result.ofStringErr match tyRes.TryGetToolTipEnhanced pos lineStr with - | Ok (Some (tip, signature, footer, typeDoc)) -> + | Ok(Some(tip, signature, footer, typeDoc)) -> let formatCommentStyle = let config = AVal.force config @@ -1997,7 +2005,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar return (Some response) | _ -> return None - | Ok (None) -> + | Ok(None) -> return! LspResult.internalError $"No TryGetToolTipEnhanced results for {filePath}" | Error e -> @@ -2136,7 +2144,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar |> AsyncResult.mapError (JsonRpc.Error.InternalErrorMessage) match usages with - | Choice1Of2 (decls, usages) -> + | Choice1Of2(decls, usages) -> return Seq.append decls.Values usages.Values |> Seq.collect (fun kvp -> kvp |> Array.map fcsRangeToLspLocation) @@ -2233,7 +2241,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let ranges: FSharp.Compiler.Text.Range[] = match res with - | LocationResponse.Use (_, uses) -> uses |> Array.map (fun u -> u.Range) + | LocationResponse.Use(_, uses) -> uses |> Array.map (fun u -> u.Range) let mappedRanges = ranges |> Array.map fcsRangeToLspLocation @@ -2307,7 +2315,8 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let uri = Path.LocalPathToUri p ns - |> Array.collect (fun n -> getSymbolInformations uri glyphToSymbolKind n (applyQuery symbolRequest.Query))) + |> Array.collect (fun n -> + getSymbolInformations uri glyphToSymbolKind n (applyQuery symbolRequest.Query))) |> Some return res @@ -2533,9 +2542,9 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar let! r = Async.Catch(f arg pos tyRes namedText lineStr typ filePath) match r with - | Choice1Of2 (r: LspResult) -> + | Choice1Of2(r: LspResult) -> match r with - | Ok (Some r) -> return r + | Ok(Some r) -> return r | _ -> return Unchecked.defaultof<_> | Choice2Of2 e -> logger.error ( @@ -2589,7 +2598,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar ) return { p with Command = None } |> Some |> success - | CoreResponse.Res (typ, parms, _) -> + | CoreResponse.Res(typ, parms, _) -> let formatted = SigantureData.formatSignature typ parms let cmd = @@ -2623,7 +2632,7 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar ) | Ok res -> match res with - | Choice1Of2 (_, uses) -> + | Choice1Of2(_, uses) -> let allUses = uses.Values |> Array.concat let cmd = @@ -3751,6 +3760,11 @@ type AdaptiveFSharpLspServer(workspaceLoader: IWorkspaceLoader, lspClient: FShar override x.Dispose() = disposables.Dispose() + override this.TextDocumentInlineValue(arg1: InlineValueParams) : AsyncLspResult = + failwith "Not Implemented" + + override this.WorkDoneProgessCancel(arg1: ProgressToken) : Async = failwith "Not Implemented" + module AdaptiveFSharpLspServer = open System.Threading.Tasks diff --git a/src/FsAutoComplete/LspServers/Common.fs b/src/FsAutoComplete/LspServers/Common.fs index 24d40c351..dede681a0 100644 --- a/src/FsAutoComplete/LspServers/Common.fs +++ b/src/FsAutoComplete/LspServers/Common.fs @@ -61,7 +61,8 @@ type DiagnosticCollection(sendDiagnostics: DocumentUri -> Diagnostic[] -> Async< Map.toArray diags |> Array.collect snd |> sendDiagnostics uri let agents = - System.Collections.Concurrent.ConcurrentDictionary * CancellationTokenSource> + System.Collections.Concurrent.ConcurrentDictionary * + CancellationTokenSource> () let rec restartAgent (fileUri: DocumentUri) = @@ -82,7 +83,7 @@ type DiagnosticCollection(sendDiagnostics: DocumentUri -> Diagnostic[] -> Async< let rec loop (state: Map) = async { match! inbox.Receive() with - | Add (source, diags) -> + | Add(source, diags) -> let newState = state |> Map.add source diags do! send uri newState return! loop newState diff --git a/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs b/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs index b00656566..b84ee731b 100644 --- a/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs +++ b/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs @@ -198,24 +198,24 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = let ws = match ws with - | ProjectResponse.Project (x, _) -> CommandResponse.project JsonSerializer.writeJson x - | ProjectResponse.ProjectError (_, errorDetails) -> + | ProjectResponse.Project(x, _) -> CommandResponse.project JsonSerializer.writeJson x + | ProjectResponse.ProjectError(_, errorDetails) -> CommandResponse.projectError JsonSerializer.writeJson errorDetails - | ProjectResponse.ProjectLoading (projectFileName) -> + | ProjectResponse.ProjectLoading(projectFileName) -> CommandResponse.projectLoading JsonSerializer.writeJson projectFileName - | ProjectResponse.WorkspaceLoad (finished) -> CommandResponse.workspaceLoad JsonSerializer.writeJson finished - | ProjectResponse.ProjectChanged (projectFileName) -> failwith "Not Implemented" + | ProjectResponse.WorkspaceLoad(finished) -> CommandResponse.workspaceLoad JsonSerializer.writeJson finished + | ProjectResponse.ProjectChanged(projectFileName) -> failwith "Not Implemented" ({ Content = ws }: PlainNotification) |> lspClient.NotifyWorkspace |> Async.Start - | NotificationEvent.ParseError (errors, file) -> + | NotificationEvent.ParseError(errors, file) -> let uri = Path.LocalPathToUri file let diags = errors |> Array.map fcsErrorToDiagnostic diagnosticCollections.SetFor(uri, "F# Compiler", diags) - | NotificationEvent.UnusedOpens (file, opens) -> + | NotificationEvent.UnusedOpens(file, opens) -> let uri = Path.LocalPathToUri file let diags = @@ -233,7 +233,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = diagnosticCollections.SetFor(uri, "F# Unused opens", diags) - | NotificationEvent.UnusedDeclarations (file, decls) -> + | NotificationEvent.UnusedDeclarations(file, decls) -> let uri = Path.LocalPathToUri file let diags = @@ -251,7 +251,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = diagnosticCollections.SetFor(uri, "F# Unused declarations", diags) - | NotificationEvent.SimplifyNames (file, decls) -> + | NotificationEvent.SimplifyNames(file, decls) -> let uri = Path.LocalPathToUri file let diags = @@ -260,7 +260,8 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = - (fun ({ Range = range + (fun + ({ Range = range RelativeName = _relName }) -> { Diagnostic.Range = fcsRangeToLsp range Code = Some "FSAC0002" @@ -313,11 +314,11 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = // |> List.toArray // diagnosticCollections.SetFor(uri, "F# Linter", diags) - | NotificationEvent.Canceled (msg) -> + | NotificationEvent.Canceled(msg) -> let ntf: PlainNotification = { Content = msg } lspClient.NotifyCancelledRequest ntf |> Async.Start - | NotificationEvent.AnalyzerMessage (messages, file) -> + | NotificationEvent.AnalyzerMessage(messages, file) -> let uri = Path.LocalPathToUri file match messages with @@ -356,7 +357,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = Data = fixes }) diagnosticCollections.SetFor(uri, "F# Analyzers", diags) - | NotificationEvent.TestDetected (file, tests) -> + | NotificationEvent.TestDetected(file, tests) -> let rec map (r: TestAdapter.TestAdapterEntry) : TestAdapter.TestAdapterEntry = @@ -586,7 +587,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = return! match commands.TryGetFileCheckerOptionsWithLinesAndLineStr(file, pos) with | ResultOrString.Error s -> async.Return [] - | ResultOrString.Ok (options, lines, lineStr) -> + | ResultOrString.Ok(options, lines, lineStr) -> try async { let! tyResOpt = commands.TryGetRecentTypeCheckResultsForFile(file) @@ -624,7 +625,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = ) return! AsyncLspResult.internalError s - | ResultOrString.Ok (options, lines, lineStr) -> + | ResultOrString.Ok(options, lines, lineStr) -> try let! tyResOpt = commands.TryGetRecentTypeCheckResultsForFile(file, options, lines) @@ -677,7 +678,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = ) return LspResult.internalError s - | ResultOrString.Ok (options, lines) -> + | ResultOrString.Ok(options, lines) -> try let! tyResOpt = commands.TryGetRecentTypeCheckResultsForFile(file) @@ -723,11 +724,11 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = let! res = action () match res with - | Ok (FormatDocumentResponse.Formatted (lines, formatted)) -> + | Ok(FormatDocumentResponse.Formatted(lines, formatted)) -> let result = handlerFormattedDoc (lines, formatted) return LspResult.success (Some(result)) - | Ok (FormatDocumentResponse.FormattedRange (lines, formatted, range)) -> + | Ok(FormatDocumentResponse.FormattedRange(lines, formatted, range)) -> let result = handleFormattedRange (lines, formatted, range) return LspResult.success (Some(result)) @@ -754,7 +755,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = Actions = Some actions } match response with - | Ok (Some { Title = "Install locally" }) -> + | Ok(Some { Title = "Install locally" }) -> do! rootPath |> Option.map (fun rootPath -> @@ -763,24 +764,28 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = if not (File.Exists dotConfig) then let! result = - Cli.Wrap("dotnet").WithArguments("new tool-manifest").WithWorkingDirectory( - rootPath - ) + Cli + .Wrap("dotnet") + .WithArguments("new tool-manifest") + .WithWorkingDirectory(rootPath) .ExecuteBufferedAsync() .Task |> Async.AwaitTask if result.ExitCode <> 0 then - fantomasLogger.warn (Log.setMessage (sprintf "Unable to create a new tool manifest in %s" rootPath)) + fantomasLogger.warn ( + Log.setMessage (sprintf "Unable to create a new tool manifest in %s" rootPath) + ) else let dotConfigContent = File.ReadAllText dotConfig if dotConfigContent.Contains("fantomas") then // uninstall a older, non-compatible version of fantomas let! result = - Cli.Wrap("dotnet").WithArguments("tool uninstall fantomas").WithWorkingDirectory( - rootPath - ) + Cli + .Wrap("dotnet") + .WithArguments("tool uninstall fantomas") + .WithWorkingDirectory(rootPath) .ExecuteBufferedAsync() .Task |> Async.AwaitTask @@ -793,9 +798,10 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = ) let! result = - Cli.Wrap("dotnet").WithArguments("tool install fantomas").WithWorkingDirectory( - rootPath - ) + Cli + .Wrap("dotnet") + .WithArguments("tool install fantomas") + .WithWorkingDirectory(rootPath) .ExecuteBufferedAsync() .Task |> Async.AwaitTask @@ -817,11 +823,11 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = ) |> Option.defaultValue (async { return () }) - | Ok (Some { Title = "Install globally" }) -> + | Ok(Some { Title = "Install globally" }) -> let! result = - Cli.Wrap("dotnet").WithArguments( - "tool install -g fantomas" - ) + Cli + .Wrap("dotnet") + .WithArguments("tool install -g fantomas") .ExecuteBufferedAsync() .Task |> Async.AwaitTask @@ -840,7 +846,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = | _ -> () return LspResult.internalError "Fantomas install not found." - | Ok (FormatDocumentResponse.Error ex) + | Ok(FormatDocumentResponse.Error ex) | Error ex -> return LspResult.internalError ex } @@ -855,7 +861,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = (match Commands.SignatureData tyRes pos lineStr with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (typ, parms, generics) -> + | CoreResponse.Res(typ, parms, generics) -> { Content = CommandResponse.signatureData FsAutoComplete.JsonSerializer.writeJson (typ, parms, generics) } |> success) |> async.Return) @@ -1334,7 +1340,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = let initialText = state.TryGetFileSource(filePath) - |> Result.fold id (fun _ -> NamedText(filePath, "")) + |> Result.bimap id (fun _ -> NamedText(filePath, "")) let evolvedFileContent = (initialText, p.ContentChanges) @@ -1398,7 +1404,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match commands.TryGetFileCheckerOptionsWithLines file with | Error _ -> return! success None - | Ok (options, lines) -> + | Ok(options, lines) -> match lines.GetLine pos with | None -> return! success None @@ -1427,7 +1433,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = (config.KeywordsAutocomplete) (config.ExternalAutocomplete) with - | CoreResponse.Res (decls, keywords) -> + | CoreResponse.Res(decls, keywords) -> let items = decls |> Array.mapi (fun id d -> @@ -1466,13 +1472,13 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = override __.CompletionItemResolve(ci: CompletionItem) = let mapHelpText (ci: CompletionItem) (text: HelpText) = match text with - | HelpText.Simple (symbolName, text) -> + | HelpText.Simple(symbolName, text) -> let d = Documentation.Markup(markdown text) { ci with Detail = Some symbolName Documentation = Some d } - | HelpText.Full (name, tip, additionalEdit) -> + | HelpText.Full(name, tip, additionalEdit) -> let (si, comment) = TipFormatter.formatCompletionItemTip tip let edits, label = @@ -1483,7 +1489,9 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = let indentation = String(' ', fcsPos.Column) $"{indentation}open {ns}\n" - let insertPos = { (fcsPos |> fcsPosToLsp) with Character = 0 } + let insertPos = + { (fcsPos |> fcsPosToLsp) with + Character = 0 } Some [| { TextEdit.NewText = text @@ -1570,7 +1578,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg |> async.Return | CoreResponse.Res None -> async.Return(success None) - | CoreResponse.Res (Some (tip, signature, footer, typeDoc)) -> + | CoreResponse.Res(Some(tip, signature, footer, typeDoc)) -> let formatCommentStyle = if config.TooltipMode = "full" then TipFormatter.FormatCommentStyle.FullEnhanced @@ -1709,7 +1717,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = |> AsyncResult.mapError (JsonRpc.Error.InternalErrorMessage) match usages with - | Choice1Of2 (decls, usages) -> + | Choice1Of2(decls, usages) -> return Seq.append decls.Values usages.Values |> Seq.collect (fun kvp -> kvp |> Array.map fcsRangeToLspLocation) @@ -1734,7 +1742,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match commands.SymbolUse tyRes pos lineStr with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> async.Return(LspResult.internalError msg) - | CoreResponse.Res (symbol, uses) -> + | CoreResponse.Res(symbol, uses) -> uses |> Array.map (fun s -> { DocumentHighlight.Range = fcsRangeToLsp s.Range @@ -1758,7 +1766,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = let ranges: FSharp.Compiler.Text.Range[] = match res with - | LocationResponse.Use (_, uses) -> uses |> Array.map (fun u -> u.Range) + | LocationResponse.Use(_, uses) -> uses |> Array.map (fun u -> u.Range) let mappedRanges = ranges |> Array.map fcsRangeToLspLocation @@ -1809,7 +1817,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (decls) -> + | CoreResponse.Res(decls) -> decls |> Array.collect (fun (n, p) -> let uri = Path.LocalPathToUri p @@ -1892,7 +1900,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match commands.TryGetFileCheckerOptionsWithLines fn with | ResultOrString.Error s -> AsyncLspResult.internalError s - | ResultOrString.Ok (opts, lines) -> + | ResultOrString.Ok(opts, lines) -> asyncResult { let (fixes: Async[]>) = codefixes @@ -1981,7 +1989,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = ) return { p with Command = None } |> success - | ResultOrString.Ok (options, lines, lineStr) -> + | ResultOrString.Ok(options, lines, lineStr) -> try let! tyRes = commands.TryGetRecentTypeCheckResultsForFile(file) @@ -1998,9 +2006,9 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = let! r = Async.Catch(f arg pos tyRes lines lineStr typ file) match r with - | Choice1Of2 (r: LspResult) -> + | Choice1Of2(r: LspResult) -> match r with - | Ok (Some r) -> return Ok r + | Ok(Some r) -> return Ok r | _ -> return Ok Unchecked.defaultof<_> | Choice2Of2 e -> logger.error ( @@ -2050,7 +2058,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = ) return { p with Command = None } |> Some |> success - | CoreResponse.Res (typ, parms, _) -> + | CoreResponse.Res(typ, parms, _) -> let formatted = SigantureData.formatSignature typ parms let cmd = @@ -2082,7 +2090,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = ) | Ok res -> match res with - | Choice1Of2 (_, uses) -> + | Choice1Of2(_, uses) -> let allUses = uses.Values |> Array.concat let cmd = @@ -2241,7 +2249,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = return! match commands.TryGetFileCheckerOptionsWithLinesAndLineStr(file, pos) with | ResultOrString.Error s -> AsyncLspResult.internalError "No options" - | ResultOrString.Ok (options, _, lineStr) -> + | ResultOrString.Ok(options, _, lineStr) -> try async { let tyResOpt = commands.TryGetRecentTypeCheckResultsForFile(file) @@ -2264,7 +2272,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = (match Commands.SignatureData tyRes pos lineStr with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (typ, parms, generics) -> + | CoreResponse.Res(typ, parms, generics) -> { Content = CommandResponse.signatureData FsAutoComplete.JsonSerializer.writeJson (typ, parms, generics) } |> success) |> async.Return) @@ -2313,7 +2321,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (decls) -> + | CoreResponse.Res(decls) -> { Content = CommandResponse.declarations FsAutoComplete.JsonSerializer.writeJson decls } |> success @@ -2333,7 +2341,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (fsc, fsi, msbuild, sdk) -> + | CoreResponse.Res(fsc, fsi, msbuild, sdk) -> { Content = CommandResponse.compilerLocation FsAutoComplete.JsonSerializer.writeJson @@ -2422,7 +2430,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (funcs) -> + | CoreResponse.Res(funcs) -> { Content = CommandResponse.fsdn FsAutoComplete.JsonSerializer.writeJson funcs } |> success @@ -2442,7 +2450,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (funcs) -> + | CoreResponse.Res(funcs) -> { Content = CommandResponse.dotnetnewlist FsAutoComplete.JsonSerializer.writeJson funcs } |> success @@ -2462,7 +2470,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2480,7 +2488,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2498,7 +2506,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2516,7 +2524,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2534,7 +2542,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2552,7 +2560,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2570,7 +2578,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2588,7 +2596,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2606,7 +2614,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2624,7 +2632,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2647,7 +2655,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match res with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (_) -> { Content = "" } |> success + | CoreResponse.Res(_) -> { Content = "" } |> success return res } @@ -2663,7 +2671,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = (match Commands.Help tyRes pos lineStr with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (t) -> + | CoreResponse.Res(t) -> { Content = CommandResponse.help FsAutoComplete.JsonSerializer.writeJson t } |> success) |> async.Return) @@ -2680,7 +2688,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = (match Commands.FormattedDocumentation tyRes pos lineStr with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> LspResult.internalError msg - | CoreResponse.Res (tip, xml, signature, footer, cm) -> + | CoreResponse.Res(tip, xml, signature, footer, cm) -> let notification: PlainNotification = { Content = CommandResponse.formattedDocumentation @@ -2702,7 +2710,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match Commands.FormattedDocumentationForSymbol tyRes p.XmlSig p.Assembly with | (CoreResponse.InfoRes msg) | (CoreResponse.ErrorRes msg) -> AsyncLspResult.internalError msg - | (CoreResponse.Res (xml, assembly, doc, signature, footer, cn)) -> + | (CoreResponse.Res(xml, assembly, doc, signature, footer, cn)) -> let xmldoc = match doc with | FSharpXmlDoc.None -> [||] @@ -2875,7 +2883,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = match commands.PipelineHints tyRes with | CoreResponse.InfoRes msg | CoreResponse.ErrorRes msg -> AsyncLspResult.internalError msg - | CoreResponse.Res (res) -> + | CoreResponse.Res(res) -> { Content = CommandResponse.pipelineHint FsAutoComplete.JsonSerializer.writeJson res } |> success |> async.Return) @@ -2883,6 +2891,11 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient) = override x.Dispose() = (x :> ILspServer).Shutdown() |> Async.Start + override this.TextDocumentInlineValue(arg1: InlineValueParams) : AsyncLspResult = + failwith "Not Implemented" + + override this.WorkDoneProgessCancel(arg1: ProgressToken) : Async = failwith "Not Implemented" + module FSharpLspServer = open System.Threading.Tasks diff --git a/src/FsAutoComplete/Parser.fs b/src/FsAutoComplete/Parser.fs index 329a5ac45..0b450bf44 100644 --- a/src/FsAutoComplete/Parser.fs +++ b/src/FsAutoComplete/Parser.fs @@ -65,8 +65,8 @@ module Parser = ) |> many |> fun o -> - o.AllowMultipleArgumentsPerToken <- true - o + o.AllowMultipleArgumentsPerToken <- true + o let waitForDebuggerOption = Option( @@ -220,16 +220,14 @@ module Parser = .Filter.ByExcluding(sourcesToExclude) .Enrich.FromLogContext() .Destructure.FSharpTypes() - .Destructure - .ByTransforming(fun r -> + .Destructure.ByTransforming(fun r -> { File = r.FileName Start = r.Start End = r.End }) .Destructure.ByTransforming(fun r -> { Line = r.Line; Column = r.Column }) .Destructure.ByTransforming(fun tok -> tok.ToString() |> box) .Destructure.ByTransforming(fun di -> box di.FullName) - .WriteTo - .Async(fun c -> + .WriteTo.Async(fun c -> c.Console( outputTemplate = outputTemplate, standardErrorFromLevel = Nullable<_>(LogEventLevel.Verbose), diff --git a/src/FsAutoComplete/paket.references b/src/FsAutoComplete/paket.references deleted file mode 100644 index 478719b38..000000000 --- a/src/FsAutoComplete/paket.references +++ /dev/null @@ -1,23 +0,0 @@ -#FSharpLint.Core -CliWrap -Destructurama.FSharp -Fantomas.Client -FSharp.Analyzers.SDK -FSharp.Compiler.Service -FSharp.Core -FSharp.UMX -FsToolkit.ErrorHandling -ICSharpCode.Decompiler -Ionide.KeepAChangelog.Tasks -Ionide.LanguageServerProtocol -Ionide.ProjInfo.ProjectSystem -Microsoft.NETFramework.ReferenceAssemblies -Microsoft.SourceLink.GitHub -Newtonsoft.Json -Serilog -Serilog.Sinks.Async -Serilog.Sinks.Console -Serilog.Sinks.File -System.CommandLine -System.Configuration.ConfigurationManager -FSharp.Data.Adaptive diff --git a/test/FsAutoComplete.DependencyManager.Dummy/FsAutoComplete.DependencyManager.Dummy.fsproj b/test/FsAutoComplete.DependencyManager.Dummy/FsAutoComplete.DependencyManager.Dummy.fsproj index 85d220d2c..df4543225 100644 --- a/test/FsAutoComplete.DependencyManager.Dummy/FsAutoComplete.DependencyManager.Dummy.fsproj +++ b/test/FsAutoComplete.DependencyManager.Dummy/FsAutoComplete.DependencyManager.Dummy.fsproj @@ -1,16 +1,11 @@ - - - - netstandard2.0 - - - - - - - - - - - - + + + + netstandard2.0 + + + + + + + diff --git a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/RenameParamToMatchSignatureTests.fs b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/RenameParamToMatchSignatureTests.fs index daa72bc34..0702f0a51 100644 --- a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/RenameParamToMatchSignatureTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/RenameParamToMatchSignatureTests.fs @@ -18,7 +18,7 @@ let tests state = // requires `fsi` and corresponding `fs` file (and a project!) // -> cannot use untitled doc // -> use existing files, but load with text specified in tests - let path = Path.Combine(__SOURCE_DIRECTORY__, @"../TestCases/CodeFixTests/RenameParamToMatchSignature/") + let path = Path.Combine(File.CurrentDir(), @"../TestCases/CodeFixTests/RenameParamToMatchSignature/") let (fsiFile, fsFile) = ("Code.fsi", "Code.fs") serverTestList (nameof RenameParamToMatchSignature) state defaultConfigDto (Some path) (fun server -> [ diff --git a/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs b/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs index 929b66a0a..8be8d4789 100644 --- a/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs @@ -8,11 +8,12 @@ open FsAutoComplete.Utils open FsAutoComplete.Lsp open FsToolkit.ErrorHandling open Utils.Server +open Utils.Utils let tests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "Completion") + let path = Path.Combine(File.CurrentDir(), "TestCases", "Completion") let! (server, events) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing events let path = Path.Combine(path, "Script.fsx") @@ -212,7 +213,7 @@ let tests state = let autocompleteTest state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "AutocompleteTest") + let path = Path.Combine(File.CurrentDir(), "TestCases", "AutocompleteTest") let! (server, event) = serverInitialize path defaultConfigDto state let projectPath = Path.Combine(path, "AutocompleteTest.fsproj") do! waitForWorkspaceFinishedParsing event @@ -226,7 +227,7 @@ let autocompleteTest state = let scriptServer = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "AutocompleteScriptTest") + let path = Path.Combine(File.CurrentDir(), "TestCases", "AutocompleteScriptTest") let! (server, event) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing event let path = Path.Combine(path, "Script.fsx") @@ -379,7 +380,7 @@ let autocompleteTest state = let autoOpenTests state = let dirPath = - Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "CompletionAutoOpenTests") + Path.Combine(File.CurrentDir(), "TestCases", "CompletionAutoOpenTests") let serverFor (scriptPath: string) = async { diff --git a/test/FsAutoComplete.Tests.Lsp/CoreTests.fs b/test/FsAutoComplete.Tests.Lsp/CoreTests.fs index 26b6b7560..493ff5687 100644 --- a/test/FsAutoComplete.Tests.Lsp/CoreTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CoreTests.fs @@ -35,7 +35,7 @@ let initTests createServer = let p: InitializeParams = { ProcessId = Some 1 - RootPath = Some __SOURCE_DIRECTORY__ + RootPath = Some (File.CurrentDir()) RootUri = None InitializationOptions = Some(Server.serialize defaultConfigDto) Capabilities = Some clientCaps @@ -105,7 +105,7 @@ let initTests createServer = let documentSymbolTest state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "DocumentSymbolTest") + let path = Path.Combine(File.CurrentDir(), "TestCases", "DocumentSymbolTest") let! (server, event) = serverInitialize path defaultConfigDto state let path = Path.Combine(path, "Script.fsx") let tdop: DidOpenTextDocumentParams = { TextDocument = loadDocument path } @@ -139,7 +139,7 @@ let documentSymbolTest state = let foldingTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "FoldingTests") + let path = Path.Combine(File.CurrentDir(), "TestCases", "FoldingTests") let! (server, event) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing event @@ -190,7 +190,7 @@ let tooltipTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "Tooltips") + let path = Path.Combine(File.CurrentDir(), "TestCases", "Tooltips") let scriptPath = Path.Combine(path, "Script.fsx") let! (server, events) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing events @@ -359,7 +359,7 @@ let tooltipTests state = let closeTests state = // Note: clear diagnostics also implies clear caches (-> remove file & project options from State). - let root = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "CloseTests") + let root = Path.Combine(File.CurrentDir(), "TestCases", "CloseTests") let workspace = Path.Combine(root, "Workspace") serverTestList "close tests" state defaultConfigDto (Some workspace) (fun server -> diff --git a/test/FsAutoComplete.Tests.Lsp/DependentFileCheckingTests.fs b/test/FsAutoComplete.Tests.Lsp/DependentFileCheckingTests.fs index b317fc9e8..7b30b12ac 100644 --- a/test/FsAutoComplete.Tests.Lsp/DependentFileCheckingTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/DependentFileCheckingTests.fs @@ -9,9 +9,10 @@ open Utils.Server open System open FSharp.Control.Reactive open FSharpx.Control +open Utils.Utils let tests state = - let root = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "DependentFileChecking", "SameProject") + let root = Path.Combine(File.CurrentDir(), "TestCases", "DependentFileChecking", "SameProject") let aFile, bFile = "A.fs", "B.fs" testList (nameof DependentFileChecking) [ // Separate server for each test @@ -29,10 +30,10 @@ let tests state = // make a change to A (that is clearly incorrect) let! startAChange = Document.changeTextTo "farts" aDoc |> Async.StartChild // start listening for new diagnostics for B - let! diagnosticsForBWaiter = - bDiagsStream - |> Observable.timeoutSpan (TimeSpan.FromSeconds 15.) - |> Async.AwaitObservable + let! diagnosticsForBWaiter = + bDiagsStream + |> Observable.timeoutSpan (TimeSpan.FromSeconds 15.) + |> Async.AwaitObservable |> Async.StartChild let! aDiags = startAChange Expect.isNonEmpty aDiags $"Should have had some compilation errors for {aFile} after erroneous changes" @@ -55,11 +56,11 @@ let tests state = // make a change to A (that is clearly incorrect) let! startAChange = Document.changeTextTo "farts" aDoc |> Async.StartChild // start listening for new diagnostics for B - let! diagnosticsForBWaiter = - bDiagsStream + let! diagnosticsForBWaiter = + bDiagsStream |> Observable.skip i - |> Observable.timeoutSpan (TimeSpan.FromSeconds 15.) - |> Async.AwaitObservable + |> Observable.timeoutSpan (TimeSpan.FromSeconds 15.) + |> Async.AwaitObservable |> Async.StartChild let! aDiags = startAChange Expect.isNonEmpty aDiags $"Should have had some compilation errors for {aFile} after erroneous change #%d{i}" diff --git a/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs b/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs index 1b7c1d9a8..d84129180 100644 --- a/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/DetectUnitTests.fs @@ -7,11 +7,12 @@ open FsAutoComplete open FsAutoComplete.LspHelpers open Helpers open FsToolkit.ErrorHandling +open Utils.Utils let tests state = let geTestNotification projectFolder fileName = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", projectFolder) + let path = Path.Combine(File.CurrentDir(), "TestCases", projectFolder) let! server, events = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing events let path = Path.Combine(path, fileName) diff --git a/test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs b/test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs index 735d8be0e..484fe5106 100644 --- a/test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/ExtensionsTests.fs @@ -8,13 +8,13 @@ open FsAutoComplete open FsAutoComplete.LspHelpers open Helpers open FsAutoComplete.Lsp - +open Utils.Utils let fsdnTest state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "FsdnTest") + let path = Path.Combine(File.CurrentDir(), "TestCases", "FsdnTest") let! (server, event) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing event return server @@ -90,7 +90,7 @@ let uriTests = let linterTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "LinterTest") + let path = Path.Combine(File.CurrentDir(), "TestCases", "LinterTest") let! (server, events) = serverInitialize path { defaultConfigDto with Linter = Some true } state let path = Path.Combine(path, "Script.fsx") let tdop: DidOpenTextDocumentParams = { TextDocument = loadDocument path } @@ -240,7 +240,7 @@ let linterTests state = let formattingTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "Formatting") + let path = Path.Combine(File.CurrentDir(), "TestCases", "Formatting") let! (server, events) = serverInitialize path defaultConfigDto state do! dotnetToolRestore path // need to restore CLI tools in order to use fantomas return server, events, path @@ -298,7 +298,7 @@ let formattingTests state = let analyzerTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "Analyzers") + let path = Path.Combine(File.CurrentDir(), "TestCases", "Analyzers") // because the analyzer is a project this project has a reference, the analyzer can be // found in alongside this project, so we can use the directory this project is in let analyzerPath = @@ -356,7 +356,7 @@ let analyzerTests state = let signatureTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "Signature") + let path = Path.Combine(File.CurrentDir(), "TestCases", "Signature") let scriptPath = Path.Combine(path, "Script.fsx") let! (server, events) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing events diff --git a/test/FsAutoComplete.Tests.Lsp/FindReferencesTests.fs b/test/FsAutoComplete.Tests.Lsp/FindReferencesTests.fs index 4e182fdaa..9e742ac84 100644 --- a/test/FsAutoComplete.Tests.Lsp/FindReferencesTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/FindReferencesTests.fs @@ -5,13 +5,14 @@ open System.IO open FsAutoComplete open Helpers open Ionide.LanguageServerProtocol.Types +open Utils.Utils let tests state = testList "Find All References tests" [ let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "FindReferences") + let path = Path.Combine(File.CurrentDir(), "TestCases", "FindReferences") let! (server, event) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing event diff --git a/test/FsAutoComplete.Tests.Lsp/FsAutoComplete.Tests.Lsp.fsproj b/test/FsAutoComplete.Tests.Lsp/FsAutoComplete.Tests.Lsp.fsproj index 6b4a693ec..6e09d51db 100644 --- a/test/FsAutoComplete.Tests.Lsp/FsAutoComplete.Tests.Lsp.fsproj +++ b/test/FsAutoComplete.Tests.Lsp/FsAutoComplete.Tests.Lsp.fsproj @@ -36,5 +36,17 @@ - + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + diff --git a/test/FsAutoComplete.Tests.Lsp/GoToTests.fs b/test/FsAutoComplete.Tests.Lsp/GoToTests.fs index d84e4f4b8..7a8a7c369 100644 --- a/test/FsAutoComplete.Tests.Lsp/GoToTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/GoToTests.fs @@ -16,7 +16,7 @@ open Utils.TextEdit let private gotoTest state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "GoToTests") + let path = Path.Combine(File.CurrentDir(), "TestCases", "GoToTests") let! (server, event) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing event @@ -489,7 +489,7 @@ let private gotoTest state = let private scriptGotoTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "GoToTests") + let path = Path.Combine(File.CurrentDir(), "TestCases", "GoToTests") let! (server, event) = serverInitialize path defaultConfigDto state do! waitForWorkspaceFinishedParsing event let scriptPath = Path.Combine(path, "Script.fsx") diff --git a/test/FsAutoComplete.Tests.Lsp/Helpers.fs b/test/FsAutoComplete.Tests.Lsp/Helpers.fs index 372254c65..09eb17fe2 100644 --- a/test/FsAutoComplete.Tests.Lsp/Helpers.fs +++ b/test/FsAutoComplete.Tests.Lsp/Helpers.fs @@ -253,7 +253,8 @@ let clientCaps: ClientCapabilities = Symbol = Some symbolCaps SemanticTokens = Some semanticTokenCaps InlayHint = Some inlayHintCaps - CodeLens = Some codeLensCaps } + CodeLens = Some codeLensCaps + InlineValue = None } let textCaps: TextDocumentClientCapabilities = let syncCaps: SynchronizationCapabilities = @@ -357,7 +358,8 @@ let clientCaps: ClientCapabilities = { Workspace = Some workspaceCaps TextDocument = Some textCaps - Experimental = None } + Experimental = None + Window = None } open Expecto.Logging open Expecto.Logging.Message diff --git a/test/FsAutoComplete.Tests.Lsp/HighlightingTests.fs b/test/FsAutoComplete.Tests.Lsp/HighlightingTests.fs index 916f9d4ab..9c698b40a 100644 --- a/test/FsAutoComplete.Tests.Lsp/HighlightingTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/HighlightingTests.fs @@ -6,9 +6,10 @@ open Helpers open FsAutoComplete.LspHelpers open Ionide.LanguageServerProtocol.Types open FsAutoComplete.Utils +open Utils.Utils let tests state = - let testPath = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "HighlightingTest") + let testPath = Path.Combine(File.CurrentDir(), "TestCases", "HighlightingTest") let scriptPath = Path.Combine(testPath, "Script.fsx") let server = diff --git a/test/FsAutoComplete.Tests.Lsp/InfoPanelTests.fs b/test/FsAutoComplete.Tests.Lsp/InfoPanelTests.fs index 6d2218fc7..6f16d7825 100644 --- a/test/FsAutoComplete.Tests.Lsp/InfoPanelTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/InfoPanelTests.fs @@ -6,11 +6,12 @@ open Ionide.LanguageServerProtocol.Types open FsAutoComplete open Helpers open FsToolkit.ErrorHandling +open Utils.Utils let docFormattingTest state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "FormattedDocumentation") + let path = Path.Combine(File.CurrentDir(), "TestCases", "FormattedDocumentation") let config = defaultConfigDto let! (server, events) = serverInitialize path config state let path = Path.Combine(path, "Script.fsx") diff --git a/test/FsAutoComplete.Tests.Lsp/RenameTests.fs b/test/FsAutoComplete.Tests.Lsp/RenameTests.fs index 5be43ab78..ead66a5e6 100644 --- a/test/FsAutoComplete.Tests.Lsp/RenameTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/RenameTests.fs @@ -20,7 +20,7 @@ let private normalizePathCasing = let tests state = let sameProjectTests = let testDir = - Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "RenameTest", "SameProject") + Path.Combine(File.CurrentDir(), "TestCases", "RenameTest", "SameProject") serverTestList "Within Same Project" state defaultConfigDto (Some testDir) (fun server -> [ testCaseAsync @@ -141,7 +141,7 @@ let tests state = NewName = newName } let! res = doc.Server.Server.TextDocumentRename p - let edits = + let edits = match res with | Result.Error e -> failtestf "Request failed: %A" e | Result.Ok None -> failtest "Request none" @@ -219,7 +219,7 @@ let tests state = let server = async { let testDir = - Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "RenameTest", "CrossProject") + Path.Combine(File.CurrentDir(), "TestCases", "RenameTest", "CrossProject") let! (server, event) = serverInitialize testDir defaultConfigDto state do! waitForWorkspaceFinishedParsing event diff --git a/test/FsAutoComplete.Tests.Lsp/ScriptTests.fs b/test/FsAutoComplete.Tests.Lsp/ScriptTests.fs index 2ef4fa925..b481b55dd 100644 --- a/test/FsAutoComplete.Tests.Lsp/ScriptTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/ScriptTests.fs @@ -11,11 +11,12 @@ open FsToolkit.ErrorHandling open FSharpx.Control.Observable open FSharp.Control.Reactive open System +open Utils.Utils let scriptPreviewTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "PreviewScriptFeatures") + let path = Path.Combine(File.CurrentDir(), "TestCases", "PreviewScriptFeatures") let scriptPath = Path.Combine(path, "Script.fsx") @@ -45,7 +46,7 @@ let scriptPreviewTests state = let scriptEvictionTests state = let server = async { - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "ScriptEviction") + let path = Path.Combine(File.CurrentDir(), "TestCases", "ScriptEviction") let scriptPath = Path.Combine(path, "Script.fsx") let! (server, events) = serverInitialize path defaultConfigDto state @@ -94,7 +95,7 @@ let dependencyManagerTests state = let server = async { let workingDir = - Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "DependencyManagement") + Path.Combine(File.CurrentDir(), "TestCases", "DependencyManagement") let dependencyManagerAssemblyDir = Path.Combine( @@ -152,7 +153,7 @@ let scriptProjectOptionsCacheTests state = let server = async { let workingDir = - Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "ScriptProjectOptsCache") + Path.Combine(File.CurrentDir(), "TestCases", "ScriptProjectOptsCache") let previewEnabledConfig = { defaultConfigDto with FSIExtraParameters = Some [| "--langversion:preview" |] } diff --git a/test/FsAutoComplete.Tests.Lsp/UnsedDeclarationsTests.fs b/test/FsAutoComplete.Tests.Lsp/UnsedDeclarationsTests.fs index f0d5456b6..65eb1bd8c 100644 --- a/test/FsAutoComplete.Tests.Lsp/UnsedDeclarationsTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/UnsedDeclarationsTests.fs @@ -130,7 +130,7 @@ let private scriptTests state = ]) let private projectTests state = - let path = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "UnusedDeclarations") + let path = Path.Combine(File.CurrentDir(), "TestCases", "UnusedDeclarations") let file = Existing "Library.fs" let config = { diff --git a/test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs b/test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs index 510aa40b1..38448e54e 100644 --- a/test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs +++ b/test/FsAutoComplete.Tests.Lsp/Utils/Server.Tests.fs @@ -222,7 +222,8 @@ let tests state = testList (nameof(Server)) [ testList "with root path" [ let inTestCases name = - System.IO.Path.Combine(__SOURCE_DIRECTORY__, "..", "TestCases", "ServerTests", name) + System.IO.Path.Combine(File.CurrentDir(), "..", "TestCases", "ServerTests", name) + |> System.IO.Path.GetFullPath |> Some let noAnalyzersConfig = @@ -592,7 +593,7 @@ f2 "bar" |> ignore serverTestList "no root path without analyzers" state defaultConfigDto None (fun server -> [ testCaseAsync "can create Document by absolute path without root path" <| async { let relativePath = "../TestCases/ServerTests/JustScript/Script.fsx" - let absolutePath = System.IO.Path.GetFullPath(System.IO.Path.Combine(__SOURCE_DIRECTORY__, relativePath)) + let absolutePath = System.IO.Path.GetFullPath(System.IO.Path.Combine(File.CurrentDir(), relativePath)) let! (doc, _) = server |> Server.openDocument absolutePath use doc = doc () diff --git a/test/FsAutoComplete.Tests.Lsp/Utils/Utils.fs b/test/FsAutoComplete.Tests.Lsp/Utils/Utils.fs index e039936d1..530dbe83a 100644 --- a/test/FsAutoComplete.Tests.Lsp/Utils/Utils.fs +++ b/test/FsAutoComplete.Tests.Lsp/Utils/Utils.fs @@ -1,5 +1,12 @@ module Utils.Utils +open System.Runtime.CompilerServices +open System.Runtime.InteropServices + +type File = + static member CurrentDir([] callerPath: string) = System.IO.Path.GetDirectoryName(callerPath) + + module Expect = open FsAutoComplete.Utils open Expecto @@ -20,9 +27,9 @@ module Expect = } /// passed Async `f` is expected to throw `Expecto.AssertException` /// -> Expecto Test in `f` is expected to fail - /// + /// /// ~ Basically fancy `Async` wrapper for `Expect.throwsT` - /// + /// /// Note: `failwith` doesn't trigger success (throws `System.Exception`). Use `failtest` instead let failure f = failureMatching (fun _ -> true) f @@ -42,7 +49,7 @@ module Position = assert(pos.Line >= 0) assert(pos.Character >= 0) - let inline eq p1 p2 = + let inline eq p1 p2 = // p1.Line = p2.Line && p1.Character = p2.Character p1 = p2 let inline gt p1 p2 = @@ -50,7 +57,7 @@ module Position = let inline geq p1 p2 = eq p1 p2 || gt p1 p2 let inline lt p1 p2 = gt p2 p1 let inline leq p1 p2 = geq p2 p1 - + /// Note: Always assumes correct order inside Range: `Start <= End` module Range = open Ionide.LanguageServerProtocol.Types @@ -64,7 +71,7 @@ module Range = range.Start = range.End /// Strict: `pos` on `Start` or `End` of `range` counts as containing - /// + /// /// ```text /// -----------------------------------> /// ^^^^^^^^^^^^^^^^^ range @@ -79,7 +86,7 @@ module Range = Position.leq range.Start pos && Position.leq pos range.End /// Loose: `pos` on `Start` or `End` of `range` doesn't count as containing - /// + /// /// ```text /// -----------------------------------> /// ^^^^^^^^^^^^^^^^^ range @@ -113,7 +120,7 @@ module Range = /// | | ^^^^^^^^ false /// | ^^^^^^^^ true /// ^^^^^^^^ false - /// ^^^^^^ false + /// ^^^^^^ false /// ^^^ false /// ^ true /// ^^^ true @@ -129,7 +136,7 @@ module Range = /// | | ^^^^^^^^ false /// | ^^^^^^^^ true /// ^^^^^^^^ true - /// ^^^^^^^ true + /// ^^^^^^^ true /// ``` let overlapsStrictly (range1: Range) (range2: Range) = range1 |> containsStrictly range2.Start @@ -139,17 +146,17 @@ module Range = range2 |> containsStrictly range1.Start || range2 |> containsStrictly range1.End - + /// Loose: Touching doesn't count as overlapping. /// Neither does both just position and same position - /// + /// /// ```text /// --------------------------> /// ^^^^^^^ /// | | | ^^^^^^^^ false /// | | ^^^^^^^^ false /// | ^^^^^^^^ true - /// ^^^^^^^ true + /// ^^^^^^^ true /// ``` /// ```text /// --------------------------> @@ -165,7 +172,7 @@ module Range = not (range1 |> touches range2) /// Strict: Touching is not disjoint - /// + /// /// ```text /// --------------------------> /// ^^^^^^^ @@ -177,7 +184,7 @@ module Range = let isDisjointStrictly (range1: Range) (range2: Range) = not <| overlapsStrictly range1 range2 /// Loose: Touching is disjoint - /// + /// /// ```text /// --------------------------> /// ^^^^^^^ @@ -200,18 +207,18 @@ module Text = text.Replace("\r\n", "\n").Replace("\r", "\n") /// Note: only works with `\n`, but fails with `\r`! - let lines (text: string) = + let lines (text: string) = assertNoCarriageReturn text text.Split '\n' - /// remove leading `\n` from triple quoted string with text starting in next line + /// remove leading `\n` from triple quoted string with text starting in next line let private trimLeadingNewLine (text: string) = if text.StartsWith '\n' then text.Substring 1 else text - /// remove trailing whitespace from last line, if last line is otherwise empty. - /// Note: keeps the `\n`! + /// remove trailing whitespace from last line, if last line is otherwise empty. + /// Note: keeps the `\n`! /// Note: doesn't trim a single line with just whitespace -> requires at least one `\n` let private trimLastWhitespacesLine (text: string) = match text.LastIndexOf '\n' with @@ -257,19 +264,19 @@ module Text = line.Substring ind ) |> String.concat "\n" - + /// Trim: /// * Leading `\n` from triple quotes string with text starting in next line /// * indentation (measured for non-empty lines) - /// * Trailing whitespace in otherwise empty last line + /// * Trailing whitespace in otherwise empty last line /// Note: `\n` isn't removed - /// + /// /// Note: Asserts the passed text contains no `\r` (neither `\r` nor `\r\n`). /// It doesn't replace `\r` with `\n` but instead fails! let trimTripleQuotation (text: string) = assertNoCarriageReturn text - text + text |> trimLeadingNewLine |> trimIndentation |> trimLastWhitespacesLine diff --git a/test/FsAutoComplete.Tests.Lsp/XmlGenerationTests.fs b/test/FsAutoComplete.Tests.Lsp/XmlGenerationTests.fs index ca06d0342..fdf0db841 100644 --- a/test/FsAutoComplete.Tests.Lsp/XmlGenerationTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/XmlGenerationTests.fs @@ -7,11 +7,12 @@ open FsToolkit.ErrorHandling open Helpers open Ionide.LanguageServerProtocol.Types open System.IO +open Utils.Utils open type System.Environment let tests state = - let testPath = Path.Combine(__SOURCE_DIRECTORY__, "TestCases", "XmlDocGen") + let testPath = Path.Combine(File.CurrentDir(), "TestCases", "XmlDocGen") let scriptPath = Path.Combine(testPath, "Script.fsx") let server = diff --git a/test/FsAutoComplete.Tests.Lsp/paket.references b/test/FsAutoComplete.Tests.Lsp/paket.references deleted file mode 100644 index 52c6efe77..000000000 --- a/test/FsAutoComplete.Tests.Lsp/paket.references +++ /dev/null @@ -1,17 +0,0 @@ -FSharp.Core -FSharp.Compiler.Service -FSharp.Control.Reactive -FSharpx.Async -Expecto -Expecto.Diff -Microsoft.NET.Test.Sdk -YoloDev.Expecto.TestSdk -AltCover -GitHubActionsTestLogger -CliWrap -FSharp.Data.Adaptive - -Microsoft.Build copy_local:false -Microsoft.Build.Framework copy_local:false -Microsoft.Build.Utilities.Core copy_local:false -Microsoft.Build.Tasks.Core copy_local: false diff --git a/test/OptionAnalyzer/OptionAnalyzer.fsproj b/test/OptionAnalyzer/OptionAnalyzer.fsproj index cb4e65bb7..65c49060f 100644 --- a/test/OptionAnalyzer/OptionAnalyzer.fsproj +++ b/test/OptionAnalyzer/OptionAnalyzer.fsproj @@ -10,5 +10,8 @@ - + + + + diff --git a/test/OptionAnalyzer/paket.references b/test/OptionAnalyzer/paket.references deleted file mode 100644 index 3e2eb776c..000000000 --- a/test/OptionAnalyzer/paket.references +++ /dev/null @@ -1,2 +0,0 @@ -FSharp.Core -FSharp.Analyzers.Sdk