From 23529056b0693524c35a8af586ef8087c1b24db9 Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Sun, 16 Jul 2023 14:20:34 +0200 Subject: [PATCH 1/7] Add support for dot in sprintf format. (#1146) --- src/FsAutoComplete/CodeFixes/ToInterpolatedString.fs | 2 +- .../CodeFixTests/ToInterpolatedStringTests.fs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/FsAutoComplete/CodeFixes/ToInterpolatedString.fs b/src/FsAutoComplete/CodeFixes/ToInterpolatedString.fs index d97c3600d..c68a89a9f 100644 --- a/src/FsAutoComplete/CodeFixes/ToInterpolatedString.fs +++ b/src/FsAutoComplete/CodeFixes/ToInterpolatedString.fs @@ -18,7 +18,7 @@ let languageFeature = lazy (LanguageFeatureShim("StringInterpolation")) /// See https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/plaintext-formatting#format-specifiers-for-printf let specifierRegex = - Regex("\\%(\\+|\\-)?\\d*(b|s|c|d|i|u|x|X|o|B|e|E|f|F|g|G|M|O|A)") + Regex(@"\%(\+|\-)?\.?\d*(b|s|c|d|i|u|x|X|o|B|e|E|f|F|g|G|M|O|A)") let validFunctionNames = set [| "printf"; "printfn"; "sprintf" |] diff --git a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/ToInterpolatedStringTests.fs b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/ToInterpolatedStringTests.fs index 44083759a..0e276a9f3 100644 --- a/test/FsAutoComplete.Tests.Lsp/CodeFixTests/ToInterpolatedStringTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CodeFixTests/ToInterpolatedStringTests.fs @@ -322,6 +322,18 @@ let tests state = $"%A{ { new System.IDisposable with member _.Dispose() = () } }" """ + testCaseAsync "Dot in decimal format" + <| CodeFix.check + server + """ + sprintf$0 "£%.2f" location.price + """ + Diagnostics.acceptAll + selectCodeFix + """ + $"£%.2f{location.price}" + """ + testCaseAsync "Reflecting into LanguageVersion" <| async { let LanguageFeatureShim = LanguageFeatureShim("StringInterpolation") From 39aa777faecd877dd7683d45c6411d4a0afdeaa2 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sun, 16 Jul 2023 15:10:33 -0400 Subject: [PATCH 2/7] Changelog for v0.61.0 --- CHANGELOG.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4a5b2d08..90b5e69e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## [0.61.0] - 2023-07-16 + +### Added + +* [Codefix: Add codefix for redundant attribute suffix.](https://github.com/fsharp/FsAutoComplete/pull/1132) (thanks @nojaf!) +* [Add module to SemanticTokenTypes](https://github.com/fsharp/FsAutoComplete/pull/1137) (thanks @nojaf!) +* [Codefix: Add type annotations to entire function](https://github.com/fsharp/FsAutoComplete/pull/1138) (thanks @nojaf!) +* [Codefix: RemovePatternArgument quick fix](https://github.com/fsharp/FsAutoComplete/pull/1142) (thanks @edgarfgp!) +* [Codefix: for interpolated string](https://github.com/fsharp/FsAutoComplete/pull/1143), [fix #1](https://github.com/fsharp/FsAutoComplete/pull/1146) (thanks @nojaf!) + +### Changed + +* [Swap maybe for option CEs](https://github.com/fsharp/FsAutoComplete/pull/1131) (thanks @TheAngryByrd!) + +### Fixed + +* [Make ServerProgressReport threadsafe](https://github.com/fsharp/FsAutoComplete/pull/1130) (thanks @TheAngryByrd!) +* [Fix range handling for code completion in interpolated strings](https://github.com/fsharp/FsAutoComplete/pull/1133) (thanks @kojo12228!) +* [Fixing Typos](https://github.com/fsharp/FsAutoComplete/pull/1136) (thanks @TheAngryByrd!) +* [FSAC Not exiting on macos/linux](https://github.com/fsharp/FsAutoComplete/pull/1141) (thanks @TheAngryByrd!) +* [CI not failing on focused tests](https://github.com/fsharp/FsAutoComplete/pull/1145) (thanks @TheAngryByrd!) + +### Removed + +* [Remove old eventlistener](https://github.com/fsharp/FsAutoComplete/pull/1134) (thanks @TheAngryByrd!) + ## [0.60.1] - 2023-07-01 ### Added From d524b0add264dfd4af461ea0b146a92cac357e9d Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sun, 16 Jul 2023 15:12:35 -0400 Subject: [PATCH 3/7] Add CONTRIBUTING file --- CONTRIBUTING.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..c6d2763b5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,14 @@ +# Contributing + + +## Release + +1. Update version in CHANGELOG.md and add notes + 1. If possible link the pull request of the changes and mention the author of the pull request +2. Create new commit + 1. `git add CHANGELOG.md` + 1. `git commit -m "changelog for v0.45.0"` +3. Make a new version tag (for example, `v0.45.0`) + 1. `git tag v0.45.0` +4. Push changes to the repo. + 1. `git push --atomic [insert-remote-branch] main v0.45.0` From d830466ad960faabd109a061e19df8358791c00e Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Fri, 21 Jul 2023 22:09:41 -0400 Subject: [PATCH 4/7] Reduce project option duplication (#1147) --- .../LspServers/AdaptiveFSharpLspServer.fs | 56 +++++++++---------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index aa91a1933..614b59bf5 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -59,28 +59,22 @@ type AdaptiveWorkspaceChosen = | Projs of amap, DateTime> | NotChosen -type LoadedProjectFile = - { ProjectOptions: Types.ProjectOptions - FSharpProjectOptions: FSharpProjectOptions - LanguageVersion: LanguageVersionShim } -type LoadedScriptFile = +[] +type LoadedProject = { FSharpProjectOptions: FSharpProjectOptions LanguageVersion: LanguageVersionShim } -type LoadedProject = - | LoadedProjectFile of LoadedProjectFile - | LoadedScriptFile of LoadedScriptFile + interface IEquatable with + member x.Equals(other) = + x.FSharpProjectOptions = other.FSharpProjectOptions - member x.FSharpProjectOptions = - match x with - | LoadedProjectFile p -> p.FSharpProjectOptions - | LoadedScriptFile p -> p.FSharpProjectOptions + override x.GetHashCode() = x.FSharpProjectOptions.GetHashCode() - member x.LanguageVersion = - match x with - | LoadedProjectFile p -> p.LanguageVersion - | LoadedScriptFile p -> p.LanguageVersion + override x.Equals(other) = + match other with + | :? LoadedProject as other -> (x :> IEquatable<_>).Equals other + | _ -> false member x.SourceFiles = x.FSharpProjectOptions.SourceFiles member x.ProjectFileName = x.FSharpProjectOptions.ProjectFileName @@ -793,9 +787,10 @@ type AdaptiveFSharpLspServer checker.ClearCaches() // if we got new projects assume we're gonna need to clear caches let options = - projectOptions - |> List.map (fun o -> - let fso = FCS.mapToFSharpProjectOptions o projectOptions + let fsharpOptions = projectOptions |> FCS.mapManyOptions |> Seq.toList + + List.zip projectOptions fsharpOptions + |> List.map (fun (projectOption, fso) -> let langversion = LanguageVersionShim.fromFSharpProjectOptions fso @@ -806,14 +801,14 @@ type AdaptiveFSharpLspServer Stamp = fso.Stamp |> Option.orElse (Some DateTime.UtcNow.Ticks) ProjectId = fso.ProjectId |> Option.orElse (Some(Guid.NewGuid().ToString())) } - { ProjectOptions = o - FSharpProjectOptions = fso - LanguageVersion = langversion }) + { FSharpProjectOptions = fso + LanguageVersion = langversion }, + projectOption) options - |> List.iter (fun loadedProject -> - let projectFileName = loadedProject.FSharpProjectOptions.ProjectFileName - let projViewerItemsNormalized = ProjectViewer.render loadedProject.ProjectOptions + |> List.iter (fun (loadedProject, projectOption) -> + let projectFileName = loadedProject.ProjectFileName + let projViewerItemsNormalized = ProjectViewer.render projectOption let responseFiles = projViewerItemsNormalized.Items @@ -833,9 +828,9 @@ type AdaptiveFSharpLspServer let ws = { ProjectFileName = projectFileName ProjectFiles = responseFiles - OutFileOpt = Option.ofObj loadedProject.ProjectOptions.TargetPath + OutFileOpt = Option.ofObj projectOption.TargetPath References = references - Extra = loadedProject.ProjectOptions + Extra = projectOption ProjectItems = projViewerItemsNormalized.Items Additionals = Map.empty } @@ -846,7 +841,7 @@ type AdaptiveFSharpLspServer notifications.Trigger(not, CancellationToken.None) - return options |> List.map LoadedProject.LoadedProjectFile + return options |> List.map fst } /// @@ -1133,9 +1128,8 @@ type AdaptiveFSharpLspServer opts |> scriptFileProjectOptions.Trigger return - LoadedScriptFile - { FSharpProjectOptions = opts - LanguageVersion = LanguageVersionShim.fromFSharpProjectOptions opts } + { FSharpProjectOptions = opts + LanguageVersion = LanguageVersionShim.fromFSharpProjectOptions opts } } return file, Option.toList projs From b159b8e9345deab750e60e545c6832ad4e3c1dde Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sat, 22 Jul 2023 21:49:58 -0400 Subject: [PATCH 5/7] changelog for v0.61.1 --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90b5e69e7..fa0cdab54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog + +## [0.61.1] - 2023-07-22 + +### Fixed + +* [Reduce project option duplication, reducing memory usage](https://github.com/fsharp/FsAutoComplete/pull/1147) (thanks @TheAngryByrd!) + + ## [0.61.0] - 2023-07-16 ### Added From 236f0dfe53f380e92bb7a2baa9c09cb7f86132c9 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Fri, 28 Jul 2023 09:13:02 -0500 Subject: [PATCH 6/7] Update Ionide.LanguageServerProtocol to get the skeleton of all 3.17 features (#1149) --- Directory.Build.props | 3 +- paket.dependencies | 2 +- paket.lock | 2 +- src/FsAutoComplete.Core/Commands.fs | 4 +- src/FsAutoComplete.Core/FileSystem.fs | 4 +- src/FsAutoComplete.Core/SignatureHelp.fs | 6 +- src/FsAutoComplete.Core/State.fs | 6 +- src/FsAutoComplete/LspHelpers.fs | 11 +- .../LspServers/AdaptiveFSharpLspServer.fs | 244 ++++++------------ src/FsAutoComplete/LspServers/Common.fs | 14 +- .../LspServers/FSharpLspClient.fs | 2 +- .../LspServers/FsAutoComplete.Lsp.fs | 226 ++++++---------- .../CompletionTests.fs | 6 +- test/FsAutoComplete.Tests.Lsp/CoreTests.fs | 9 +- test/FsAutoComplete.Tests.Lsp/Helpers.fs | 110 ++++++-- .../SignatureHelpTests.fs | 2 +- test/FsAutoComplete.Tests.Lsp/Utils/Server.fs | 10 +- .../Utils/TextEdit.fs | 10 +- .../XmlGenerationTests.fs | 2 +- 19 files changed, 305 insertions(+), 368 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 511914bd1..4b7f3db85 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -4,7 +4,8 @@ FsAutoComplete FsAutoComplete Apache-2.0 - 3186,0042 + $(NoWarn);3186,0042 + $(NoWarn);NU1902 true $(MSBuildThisFileDirectory)CHANGELOG.md diff --git a/paket.dependencies b/paket.dependencies index bacbcf507..d554c0279 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -53,7 +53,7 @@ nuget Expecto.Diff nuget YoloDev.Expecto.TestSdk nuget AltCover nuget GitHubActionsTestLogger -nuget Ionide.LanguageServerProtocol >= 0.4.12 +nuget Ionide.LanguageServerProtocol >= 0.4.16 nuget Microsoft.Extensions.Caching.Memory nuget OpenTelemetry.Exporter.OpenTelemetryProtocol >= 1.3.2 diff --git a/paket.lock b/paket.lock index 056ccc40c..5989f1e8e 100644 --- a/paket.lock +++ b/paket.lock @@ -125,7 +125,7 @@ NUGET System.Collections.Immutable (>= 5.0) System.Reflection.Metadata (>= 5.0) Ionide.KeepAChangelog.Tasks (0.1.8) - copy_local: true - Ionide.LanguageServerProtocol (0.4.14) + Ionide.LanguageServerProtocol (0.4.17) FSharp.Core (>= 6.0) Newtonsoft.Json (>= 13.0.1) StreamJsonRpc (>= 2.10.44) diff --git a/src/FsAutoComplete.Core/Commands.fs b/src/FsAutoComplete.Core/Commands.fs index b766fe9b5..cf8a5271e 100644 --- a/src/FsAutoComplete.Core/Commands.fs +++ b/src/FsAutoComplete.Core/Commands.fs @@ -1351,7 +1351,7 @@ type Commands state.Files.[file] <- { LastTouched = DateTime.Now Source = text - Version = None } + Version = 0 } Some text | None -> None @@ -1697,7 +1697,7 @@ type Commands } scriptFileProjectOptions.Trigger projectOptions - state.AddFileTextAndCheckerOptions(file, text, projectOptions, Some version) + state.AddFileTextAndCheckerOptions(file, text, projectOptions, version) fileStateSet.Trigger() return Some projectOptions | None -> diff --git a/src/FsAutoComplete.Core/FileSystem.fs b/src/FsAutoComplete.Core/FileSystem.fs index bc29e1bd8..24921b977 100644 --- a/src/FsAutoComplete.Core/FileSystem.fs +++ b/src/FsAutoComplete.Core/FileSystem.fs @@ -758,7 +758,7 @@ type RoslynSourceTextFactory() = type VolatileFile = { LastTouched: DateTime Source: IFSACSourceText - Version: int option } + Version: int } member this.FileName = this.Source.FileName @@ -775,7 +775,7 @@ type VolatileFile = /// Helper method to create a VolatileFile - static member Create(source: IFSACSourceText, ?version: int, ?touched: DateTime) = + static member Create(source: IFSACSourceText, version: int, ?touched: DateTime) = let touched = match touched with | Some t -> t diff --git a/src/FsAutoComplete.Core/SignatureHelp.fs b/src/FsAutoComplete.Core/SignatureHelp.fs index a779c1fdb..4e85e73e2 100644 --- a/src/FsAutoComplete.Core/SignatureHelp.fs +++ b/src/FsAutoComplete.Core/SignatureHelp.fs @@ -22,7 +22,7 @@ type SignatureHelpInfo = /// if present, the index of the method we think is the current one (will never be outside the bounds of the Methods array) ActiveOverload: int option /// if present, the index of the parameter on the active method (will never be outside the bounds of the Parameters array on the selected method) - ActiveParameter: int option + ActiveParameter: uint option SigHelpKind: SignatureHelpKind } @@ -116,7 +116,7 @@ let private getSignatureHelpForFunctionApplication tyRes.GetCheckResults.GetMethods(symbolStart.Line, symbolUse.Range.EndColumn, symbolStartLineText, None) return - { ActiveParameter = Some argumentIndex + { ActiveParameter = Some(uint argumentIndex) Methods = methods.Methods ActiveOverload = None SigHelpKind = FunctionApplication } @@ -202,7 +202,7 @@ let private getSignatureHelpForMethod return - { ActiveParameter = Some argumentIndex + { ActiveParameter = Some(uint argumentIndex) Methods = filteredMethods ActiveOverload = methodCandidate SigHelpKind = MethodCall } diff --git a/src/FsAutoComplete.Core/State.fs b/src/FsAutoComplete.Core/State.fs index 118166f86..cae2c9fdd 100644 --- a/src/FsAutoComplete.Core/State.fs +++ b/src/FsAutoComplete.Core/State.fs @@ -189,7 +189,7 @@ type State = x.Files.[file] <- { Source = text LastTouched = DateTime.Now - Version = None } + Version = 0 } opts) @@ -209,14 +209,14 @@ type State = |> Seq.map (fun (s, proj: FSharpProjectOptions) -> s, LanguageVersionShim.fromFSharpProjectOptions proj) member x.TryGetFileVersion(file: string) : int option = - x.Files.TryFind file |> Option.bind (fun f -> f.Version) + x.Files.TryFind file |> Option.map (fun f -> f.Version) member x.TryGetLastCheckedVersion(file: string) : int option = x.LastCheckedVersion.TryFind file member x.SetFileVersion (file: string) (version: int) = x.Files.TryFind file |> Option.iter (fun n -> - let fileState = { n with Version = Some version } + let fileState = { n with Version = version } x.Files.[file] <- fileState) member x.SetLastCheckedVersion (file: string) (version: int) = x.LastCheckedVersion.[file] <- version diff --git a/src/FsAutoComplete/LspHelpers.fs b/src/FsAutoComplete/LspHelpers.fs index c9a6f2938..91d60d5a4 100644 --- a/src/FsAutoComplete/LspHelpers.fs +++ b/src/FsAutoComplete/LspHelpers.fs @@ -131,11 +131,13 @@ module Conversions = { Uri = uri Range = fcsRangeToLsp decl.Range } - let sym = - { SymbolInformation.Name = decl.LogicalName + let sym: SymbolInformation = + { Name = decl.LogicalName Kind = kind Location = location - ContainerName = container } + ContainerName = container + Tags = None + Deprecated = None } if symbolFilter sym then Some sym else None @@ -428,7 +430,8 @@ module Structure = StartLine = lsp.Start.Line EndCharacter = Some lsp.End.Character EndLine = lsp.End.Line - Kind = kind } + Kind = kind + CollapsedText = None } module ClassificationUtils = [] diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index 614b59bf5..5d0230d7d 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -16,6 +16,8 @@ open Newtonsoft.Json.Linq open Ionide.ProjInfo.ProjectSystem open System.Reactive open System.Reactive.Linq +open System.Runtime.CompilerServices +open System.Runtime.InteropServices open FsAutoComplete.Adaptive open FSharp.Control.Reactive @@ -234,7 +236,11 @@ type AdaptiveFSharpLspServer let sendDiagnostics (uri: DocumentUri) (diags: Diagnostic[]) = logger.info (Log.setMessageI $"SendDiag for {uri:file}: {diags.Length:diags} entries") - { Uri = uri; Diagnostics = diags } |> lspClient.TextDocumentPublishDiagnostics + // TODO: providing version would be very useful + { Uri = uri + Diagnostics = diags + Version = None } + |> lspClient.TextDocumentPublishDiagnostics let mutable lastFSharpDocumentationTypeCheck: ParseAndCheckResults option = None @@ -916,10 +922,9 @@ type AdaptiveFSharpLspServer let changes = ps - |> Seq.sortBy (fun (x, _) -> x.TextDocument.Version.Value) + |> Seq.sortBy (fun (x, _) -> x.TextDocument.Version) |> Seq.collect (fun (p, touched) -> - p.ContentChanges - |> Array.map (fun x -> x, p.TextDocument.Version.Value, touched)) + p.ContentChanges |> Array.map (fun x -> x, p.TextDocument.Version, touched)) let file = (file, changes) @@ -1038,7 +1043,7 @@ type AdaptiveFSharpLspServer return { LastTouched = File.getLastWriteTimeOrDefaultNow file Source = source - Version = None } + Version = 0 } with e -> logger.warn ( @@ -2094,6 +2099,30 @@ type AdaptiveFSharpLspServer member __.ScriptFileProjectOptions = scriptFileProjectOptions.Publish + member private x.logUnimplementedRequest<'t, 'u> + ( + argValue: 't, + [] caller: string + ) = + logger.info ( + Log.setMessage $"{caller} request: {{parms}}" + >> Log.addContextDestructured "parms" argValue + ) + + Helpers.notImplemented<'u> + + member private x.logIgnoredNotification<'t> + ( + argValue: 't, + [] caller: string + ) = + logger.info ( + Log.setMessage $"{caller} request: {{parms}}" + >> Log.addContextDestructured "parms" argValue + ) + + Helpers.ignoreNotification + interface IFSharpLspServer with override x.Shutdown() = (x :> System.IDisposable).Dispose() |> async.Return @@ -2118,7 +2147,7 @@ type AdaptiveFSharpLspServer >> Log.addContextDestructured "items" c ) - let inlineValueToggle = + let inlineValueToggle: InlineValueOptions option = match c.InlineValues.Enabled with | Some true -> Some { ResolveProvider = Some false } | Some false -> None @@ -2344,9 +2373,7 @@ type AdaptiveFSharpLspServer } |> Option.defaultWith (fun () -> // Very unlikely to get here - VolatileFile.Create(sourceTextFactory.Create(filePath, p.Text.Value)) - - ) + VolatileFile.Create(sourceTextFactory.Create(filePath, p.Text.Value), 0)) transact (fun () -> updateOpenFiles file @@ -2394,7 +2421,8 @@ type AdaptiveFSharpLspServer if lineStr.StartsWith "#" then let completionList = { IsIncomplete = false - Items = KeywordList.hashSymbolCompletionItems } + Items = KeywordList.hashSymbolCompletionItems + ItemDefaults = None } return! success (Some completionList) @@ -2517,7 +2545,11 @@ type AdaptiveFSharpLspServer else Array.append items KeywordList.keywordCompletionItems - let completionList = { IsIncomplete = false; Items = its } + let completionList = + { IsIncomplete = false + Items = its + ItemDefaults = None } + success (Some completionList) with e -> @@ -2670,14 +2702,15 @@ type AdaptiveFSharpLspServer let parameters = m.Parameters |> Array.map (fun p -> - { ParameterInformation.Label = p.ParameterName + { ParameterInformation.Label = U2.First p.ParameterName Documentation = Some(Documentation.String p.CanonicalTypeTextForSorting) }) let d = Documentation.Markup(markdown comment) { SignatureInformation.Label = signature Documentation = Some d - Parameters = Some parameters }) + Parameters = Some parameters + ActiveParameter = None }) let res = { Signatures = sigs @@ -2858,7 +2891,7 @@ type AdaptiveFSharpLspServer let! version = async { let! file = forceFindOpenFileOrRead file - return file |> Option.ofResult |> Option.bind (fun (f) -> f.Version) + return file |> Option.ofResult |> Option.map (fun (f) -> f.Version) } return @@ -3156,6 +3189,7 @@ type AdaptiveFSharpLspServer ns |> Array.collect (fun n -> getSymbolInformations uri glyphToSymbolKind n (applyQuery symbolRequest.Query))) + |> U2.First |> Some return res @@ -3307,7 +3341,7 @@ type AdaptiveFSharpLspServer let tryGetFileVersion filePath = async { let! foo = forceFindOpenFileOrRead filePath - return foo |> Option.ofResult |> Option.bind (fun (f) -> f.Version) + return foo |> Option.ofResult |> Option.map (fun (f) -> f.Version) } let clientCapabilities = clientCapabilities |> AVal.force @@ -3858,151 +3892,67 @@ type AdaptiveFSharpLspServer } //unsupported -- begin - override x.CodeActionResolve(p) = - logger.info ( - Log.setMessage "CodeActionResolve Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.CodeActionResolve(p) = x.logUnimplementedRequest p - Helpers.notImplemented + override x.DocumentLinkResolve(p) = x.logUnimplementedRequest p - override x.DocumentLinkResolve(p) = - logger.info ( - Log.setMessage "CodeActionResolve Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.Exit() = x.logIgnoredNotification (()) - Helpers.notImplemented + override x.InlayHintResolve p = x.logUnimplementedRequest p - override x.Exit() = Helpers.ignoreNotification + override x.TextDocumentDocumentColor p = x.logUnimplementedRequest p - override x.InlayHintResolve p = - logger.info ( - Log.setMessage "InlayHintResolve Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentColorPresentation p = x.logUnimplementedRequest p - Helpers.notImplemented + override x.TextDocumentDocumentLink p = x.logUnimplementedRequest p - override x.TextDocumentDocumentColor p = - logger.info ( - Log.setMessage "TextDocumentDocumentColor Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentOnTypeFormatting p = x.logUnimplementedRequest p - Helpers.notImplemented + override x.TextDocumentSemanticTokensFullDelta p = x.logUnimplementedRequest p - override x.TextDocumentColorPresentation p = - logger.info ( - Log.setMessage "TextDocumentColorPresentation Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentWillSave p = x.logIgnoredNotification p - Helpers.notImplemented + override x.TextDocumentWillSaveWaitUntil p = x.logUnimplementedRequest p - override x.TextDocumentDocumentLink p = - logger.info ( - Log.setMessage "TextDocumentDocumentLink Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.WorkspaceDidChangeWorkspaceFolders p = x.logIgnoredNotification p - Helpers.notImplemented + override x.WorkspaceDidCreateFiles p = x.logIgnoredNotification p - override x.TextDocumentOnTypeFormatting p = - logger.info ( - Log.setMessage "TextDocumentOnTypeFormatting Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.WorkspaceDidDeleteFiles p = x.logIgnoredNotification p - Helpers.notImplemented + override x.WorkspaceDidRenameFiles p = x.logIgnoredNotification p - override x.TextDocumentSemanticTokensFullDelta p = - logger.info ( - Log.setMessage "TextDocumentSemanticTokensFullDelta Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.WorkspaceExecuteCommand p = x.logUnimplementedRequest p - Helpers.notImplemented + override x.WorkspaceWillCreateFiles p = x.logUnimplementedRequest p - override x.TextDocumentWillSave p = - logger.info ( - Log.setMessage "TextDocumentWillSave Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.WorkspaceWillDeleteFiles p = x.logUnimplementedRequest p - Helpers.ignoreNotification + override x.WorkspaceWillRenameFiles p = x.logUnimplementedRequest p - override x.TextDocumentWillSaveWaitUntil p = - logger.info ( - Log.setMessage "TextDocumentWillSaveWaitUntil Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.notImplemented - - override x.WorkspaceDidChangeWorkspaceFolders p = - logger.info ( - Log.setMessage "WorkspaceDidChangeWorkspaceFolders Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.ignoreNotification - - override x.WorkspaceDidCreateFiles p = - logger.info ( - Log.setMessage "WorkspaceDidCreateFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.ignoreNotification - - override x.WorkspaceDidDeleteFiles p = - logger.info ( - Log.setMessage "WorkspaceDidDeleteFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.CallHierarchyIncomingCalls p = x.logUnimplementedRequest p - Helpers.ignoreNotification + override x.CallHierarchyOutgoingCalls p = x.logUnimplementedRequest p - override x.WorkspaceDidRenameFiles p = - logger.info ( - Log.setMessage "WorkspaceDidRenameFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentPrepareCallHierarchy p = x.logUnimplementedRequest p - Helpers.ignoreNotification + override x.TextDocumentPrepareTypeHierarchy p = x.logUnimplementedRequest p - override x.WorkspaceExecuteCommand p = - logger.info ( - Log.setMessage "WorkspaceExecuteCommand Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TypeHierarchySubtypes p = x.logUnimplementedRequest p - Helpers.notImplemented + override x.TypeHierarchySupertypes p = x.logUnimplementedRequest p - override x.WorkspaceWillCreateFiles p = - logger.info ( - Log.setMessage "WorkspaceWillCreateFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentDeclaration p = x.logUnimplementedRequest p - Helpers.notImplemented + override x.TextDocumentDiagnostic p = x.logUnimplementedRequest p - override x.WorkspaceWillDeleteFiles p = - logger.info ( - Log.setMessage "WorkspaceWillDeleteFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentLinkedEditingRange p = x.logUnimplementedRequest p - Helpers.notImplemented + override x.TextDocumentMoniker p = x.logUnimplementedRequest p - override x.WorkspaceWillRenameFiles p = - logger.info ( - Log.setMessage "WorkspaceWillRenameFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.WorkspaceDiagnostic p = x.logUnimplementedRequest p - Helpers.notImplemented + override x.WorkspaceSymbolResolve p = x.logUnimplementedRequest p //unsupported -- end @@ -4120,7 +4070,9 @@ type AdaptiveFSharpLspServer Edit = { DocumentChanges = Some - [| { TextDocument = p.TextDocument + [| { TextDocument = + { Uri = p.TextDocument.Uri + Version = Some p.TextDocument.Version } Edits = [| { Range = fcsPosToProtocolRange insertPos NewText = text } |] } |] @@ -4879,36 +4831,6 @@ type AdaptiveFSharpLspServer return () } - member this.CallHierarchyIncomingCalls - (arg1: CallHierarchyIncomingCallsParams) - : AsyncLspResult = - failwith "Not Implemented" - - member this.CallHierarchyOutgoingCalls - (arg1: CallHierarchyOutgoingCallsParams) - : AsyncLspResult = - failwith "Not Implemented" - - member this.TextDocumentPrepareCallHierarchy - (arg1: CallHierarchyPrepareParams) - : AsyncLspResult = - failwith "Not Implemented" - - member this.TextDocumentPrepareTypeHierarchy - (arg1: TypeHierarchyPrepareParams) - : AsyncLspResult = - failwith "Not Implemented" - - member this.TypeHierarchySubtypes - (arg1: TypeHierarchySubtypesParams) - : AsyncLspResult = - failwith "Not Implemented" - - member this.TypeHierarchySupertypes - (arg1: TypeHierarchySupertypesParams) - : AsyncLspResult = - failwith "Not Implemented" - module AdaptiveFSharpLspServer = open System.Threading.Tasks diff --git a/src/FsAutoComplete/LspServers/Common.fs b/src/FsAutoComplete/LspServers/Common.fs index 00fb67e7a..4d38f4fe7 100644 --- a/src/FsAutoComplete/LspServers/Common.fs +++ b/src/FsAutoComplete/LspServers/Common.fs @@ -216,8 +216,8 @@ module Helpers = ImplementationProvider = Some true ReferencesProvider = Some true DocumentHighlightProvider = Some true - DocumentSymbolProvider = Some true - WorkspaceSymbolProvider = Some true + DocumentSymbolProvider = Some(U2.Second { Label = Some "F#" }) + WorkspaceSymbolProvider = Some(U2.Second { ResolveProvider = Some true }) DocumentFormattingProvider = Some true DocumentRangeFormattingProvider = Some true SignatureHelpProvider = @@ -229,12 +229,14 @@ module Helpers = { ResolveProvider = Some true TriggerCharacters = Some([| '.'; ''' |]) AllCommitCharacters = None //TODO: what chars shoudl commit completions? - } + CompletionItem = None } CodeLensProvider = Some { CodeLensOptions.ResolveProvider = Some true } CodeActionProvider = - Some - { CodeActionKinds = None - ResolveProvider = None } + Some( + U2.Second + { CodeActionKinds = None + ResolveProvider = None } + ) TextDocumentSync = Some { TextDocumentSyncOptions.Default with diff --git a/src/FsAutoComplete/LspServers/FSharpLspClient.fs b/src/FsAutoComplete/LspServers/FSharpLspClient.fs index 9681c52d6..8997528b6 100644 --- a/src/FsAutoComplete/LspServers/FSharpLspClient.fs +++ b/src/FsAutoComplete/LspServers/FSharpLspClient.fs @@ -49,7 +49,7 @@ type FSharpLspClient(sendServerNotification: ClientNotificationSender, sendServe override __.WorkspaceSemanticTokensRefresh() = sendServerNotification "workspace/semanticTokens/refresh" () |> Async.Ignore - override __.TextDocumentPublishDiagnostics(p) = + override __.TextDocumentPublishDiagnostics(p: PublishDiagnosticsParams) = sendServerNotification "textDocument/publishDiagnostics" (box p) |> Async.Ignore ///Custom notification for workspace/solution/project loading events diff --git a/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs b/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs index 2ac79d6f9..9994b6b61 100644 --- a/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs +++ b/src/FsAutoComplete/LspServers/FsAutoComplete.Lsp.fs @@ -28,6 +28,8 @@ open FSharp.Compiler.Symbols open Fantomas.Client.Contracts open Fantomas.Client.LSPFantomasService open FSharp.Compiler.Text.Position +open System.Runtime.CompilerServices +open System.Runtime.InteropServices open FsAutoComplete.Lsp open Ionide.LanguageServerProtocol.Types.AsyncLspResult @@ -75,7 +77,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory lspClient.NotifyDocumentAnalyzed { TextDocument = { Uri = filePath |> Path.LocalPathToUri - Version = Some version } } + Version = version } } } /// UTC Time of start of last `checkFile` call @@ -147,7 +149,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory async { let doc = p.TextDocument let filePath = doc.GetFilePath() |> Utils.normalizePath - let version = doc.Version.Value // this always has a value, despite the Option type + let version = doc.Version match state.TryGetFileSource(filePath) with | Ok content -> @@ -182,7 +184,11 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory >> Log.addContextDestructured "diags" diags.Length ) - { Uri = uri; Diagnostics = diags } |> lspClient.TextDocumentPublishDiagnostics + //TODO: it would be _amazing_ to flow version through to here + { Uri = uri + Diagnostics = diags + Version = None } + |> lspClient.TextDocumentPublishDiagnostics let diagnosticCollections = new DiagnosticCollection(sendDiagnostics) @@ -885,163 +891,81 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory | Some encoded -> return! success (Some { Data = encoded; ResultId = None }) // TODO: provide a resultId when we support delta ranges } - member __.ScriptFileProjectOptions = commands.ScriptFileProjectOptions - - interface IFSharpLspServer with - - - //unsupported -- begin - - override x.CodeActionResolve(p) = - logger.info ( - Log.setMessage "CodeActionResolve Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.notImplemented - - override x.DocumentLinkResolve(p) = - logger.info ( - Log.setMessage "CodeActionResolve Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.notImplemented - - override x.Exit() = Helpers.ignoreNotification - - override x.InlayHintResolve p = - logger.info ( - Log.setMessage "InlayHintResolve Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.notImplemented - - override x.TextDocumentDocumentColor p = - logger.info ( - Log.setMessage "TextDocumentDocumentColor Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.notImplemented - - override x.TextDocumentColorPresentation p = - logger.info ( - Log.setMessage "TextDocumentColorPresentation Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.notImplemented - - override x.TextDocumentDocumentLink p = - logger.info ( - Log.setMessage "TextDocumentDocumentLink Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.notImplemented - - override x.TextDocumentOnTypeFormatting p = - logger.info ( - Log.setMessage "TextDocumentOnTypeFormatting Request: {parms}" - >> Log.addContextDestructured "parms" p - ) - - Helpers.notImplemented + member private x.logUnimplementedRequest<'t, 'u> + ( + argValue: 't, + [] caller: string + ) = + logger.info ( + Log.setMessage $"{caller} request: {{parms}}" + >> Log.addContextDestructured "parms" argValue + ) - override x.TextDocumentSemanticTokensFullDelta p = - logger.info ( - Log.setMessage "TextDocumentSemanticTokensFullDelta Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + Helpers.notImplemented<'u> - Helpers.notImplemented + member private x.logIgnoredNotification<'t> + ( + argValue: 't, + [] caller: string + ) = + logger.info ( + Log.setMessage $"{caller} request: {{parms}}" + >> Log.addContextDestructured "parms" argValue + ) - override x.TextDocumentWillSave p = - logger.info ( - Log.setMessage "TextDocumentWillSave Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + Helpers.ignoreNotification - Helpers.ignoreNotification + member __.ScriptFileProjectOptions = commands.ScriptFileProjectOptions - override x.TextDocumentWillSaveWaitUntil p = - logger.info ( - Log.setMessage "TextDocumentWillSaveWaitUntil Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + interface IFSharpLspServer with - Helpers.notImplemented - override x.WorkspaceDidChangeWorkspaceFolders p = - logger.info ( - Log.setMessage "WorkspaceDidChangeWorkspaceFolders Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + //unsupported -- begin - Helpers.ignoreNotification + override x.CodeActionResolve(p) = x.logUnimplementedRequest (p) - override x.WorkspaceDidCreateFiles p = - logger.info ( - Log.setMessage "WorkspaceDidCreateFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.DocumentLinkResolve(p) = x.logUnimplementedRequest (p) - Helpers.ignoreNotification + override x.Exit() = x.logIgnoredNotification (()) - override x.WorkspaceDidDeleteFiles p = - logger.info ( - Log.setMessage "WorkspaceDidDeleteFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.InlayHintResolve p = x.logUnimplementedRequest (p) - Helpers.ignoreNotification + override x.TextDocumentDocumentColor p = x.logUnimplementedRequest (p) - override x.WorkspaceDidRenameFiles p = - logger.info ( - Log.setMessage "WorkspaceDidRenameFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentColorPresentation p = x.logUnimplementedRequest (p) - Helpers.ignoreNotification + override x.TextDocumentDocumentLink p = x.logUnimplementedRequest (p) - override x.WorkspaceExecuteCommand p = - logger.info ( - Log.setMessage "WorkspaceExecuteCommand Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentOnTypeFormatting p = x.logUnimplementedRequest (p) - Helpers.notImplemented + override x.TextDocumentSemanticTokensFullDelta p = x.logUnimplementedRequest (p) - override x.WorkspaceWillCreateFiles p = - logger.info ( - Log.setMessage "WorkspaceWillCreateFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.TextDocumentWillSave p = x.logIgnoredNotification (p) - Helpers.notImplemented + override x.TextDocumentWillSaveWaitUntil p = x.logUnimplementedRequest (p) - override x.WorkspaceWillDeleteFiles p = - logger.info ( - Log.setMessage "WorkspaceWillDeleteFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.WorkspaceDidChangeWorkspaceFolders p = x.logIgnoredNotification (p) - Helpers.notImplemented + override x.WorkspaceDidCreateFiles p = x.logIgnoredNotification (p) - override x.WorkspaceWillRenameFiles p = - logger.info ( - Log.setMessage "WorkspaceWillRenameFiles Request: {parms}" - >> Log.addContextDestructured "parms" p - ) + override x.WorkspaceDidDeleteFiles p = x.logIgnoredNotification (p) - Helpers.notImplemented + override x.WorkspaceDidRenameFiles p = x.logIgnoredNotification (p) + override x.WorkspaceExecuteCommand p = x.logUnimplementedRequest (p) + override x.WorkspaceWillCreateFiles p = x.logUnimplementedRequest (p) + override x.WorkspaceWillDeleteFiles p = x.logUnimplementedRequest (p) + override x.WorkspaceWillRenameFiles p = x.logUnimplementedRequest (p) + override x.TextDocumentDeclaration p = x.logUnimplementedRequest (p) + override x.TextDocumentDiagnostic p = x.logUnimplementedRequest (p) + override x.TextDocumentLinkedEditingRange p = x.logUnimplementedRequest (p) + override x.TextDocumentMoniker p = x.logUnimplementedRequest (p) + override x.WorkspaceDiagnostic p = x.logUnimplementedRequest (p) + override x.WorkspaceSymbolResolve p = x.logUnimplementedRequest (p) //unsupported -- end @@ -1114,7 +1038,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory return result } - let inlineValueToggle = + let inlineValueToggle: InlineValueOptions option = match c.InlineValues.Enabled with | Some true -> Some { ResolveProvider = Some false } | Some false -> None @@ -1325,7 +1249,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory >> Log.addContextDestructured "parms" filePath ) - commands.SetFileContent(filePath, content, Some doc.Version) + commands.SetFileContent(filePath, content, doc.Version) do! checkFile (filePath, doc.Version, content, true) @@ -1343,7 +1267,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory let doc = p.TextDocument let filePath = doc.GetFilePath() |> Utils.normalizePath // types are incorrect for this endpoint - version is always supplied by the client - let endVersion = doc.Version.Value + let endVersion = doc.Version logger.info ( Log.setMessage "TextDocumentDidChange Request: {parms}" @@ -1377,7 +1301,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory text) - commands.SetFileContent(filePath, evolvedFileContent, Some endVersion) + commands.SetFileContent(filePath, evolvedFileContent, endVersion) checkFileDebouncer.Bounce p } @@ -1425,7 +1349,8 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory if lineStr.StartsWith "#" then let completionList = { IsIncomplete = false - Items = KeywordList.hashSymbolCompletionItems } + Items = KeywordList.hashSymbolCompletionItems + ItemDefaults = None } return! success (Some completionList) else @@ -1475,11 +1400,22 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory else Array.append items KeywordList.keywordCompletionItems - let completionList = { IsIncomplete = false; Items = its } + let completionList = + { IsIncomplete = false + Items = its + ItemDefaults = None } + return! success (Some completionList) | _ -> logger.info (Log.setMessage "TextDocumentCompletion - no completion results") - return! success (Some { IsIncomplete = false; Items = [||] }) + + return! + success ( + Some + { IsIncomplete = false + Items = [||] + ItemDefaults = None } + ) } override __.CompletionItemResolve(ci: CompletionItem) = @@ -1566,14 +1502,15 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory let parameters = m.Parameters |> Array.map (fun p -> - { ParameterInformation.Label = p.ParameterName + { ParameterInformation.Label = U2.First p.ParameterName Documentation = Some(Documentation.String p.CanonicalTypeTextForSorting) }) let d = Documentation.Markup(markdown comment) { SignatureInformation.Label = signature Documentation = Some d - Parameters = Some parameters }) + Parameters = Some parameters + ActiveParameter = None }) let res = { Signatures = sigs @@ -1854,6 +1791,7 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory |> Array.collect (fun (n, p) -> let uri = Path.LocalPathToUri p getSymbolInformations uri glyphToSymbolKind n (applyQuery symbolRequest.Query)) + |> U2.First |> Some |> success @@ -2317,7 +2255,9 @@ type FSharpLspServer(state: State, lspClient: FSharpLspClient, sourceTextFactory Edit = { DocumentChanges = Some - [| { TextDocument = p.TextDocument + [| { TextDocument = + { Uri = p.TextDocument.Uri + Version = Some p.TextDocument.Version } Edits = [| { Range = fcsPosToProtocolRange insertPos NewText = text } |] } |] diff --git a/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs b/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs index 31a1a8207..eb34d6758 100644 --- a/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CompletionTests.fs @@ -75,7 +75,7 @@ let tests state = let textChange : DidChangeTextDocumentParams = { - TextDocument = { Uri = Path.FilePathToUri path ; Version = Some 1} + TextDocument = { Uri = Path.FilePathToUri path ; Version = 1} ContentChanges = [| { Range = Some { Start = { Line = line; Character = character }; End = { Line = line; Character = character } } @@ -162,7 +162,7 @@ let tests state = let textChange : DidChangeTextDocumentParams = { - TextDocument = { Uri = Path.FilePathToUri path ; Version = Some 1} + TextDocument = { Uri = Path.FilePathToUri path ; Version = 1} ContentChanges = [| { Range = Some { Start = { Line = line; Character = character }; End = { Line = line; Character = character } } @@ -249,7 +249,7 @@ let tests state = let textChange : DidChangeTextDocumentParams = { - TextDocument = { Uri = Path.FilePathToUri path ; Version = Some 1} + TextDocument = { Uri = Path.FilePathToUri path ; Version = 1} ContentChanges = [| { Range = Some { Start = { Line = line; Character = character }; End = { Line = line; Character = character } } diff --git a/test/FsAutoComplete.Tests.Lsp/CoreTests.fs b/test/FsAutoComplete.Tests.Lsp/CoreTests.fs index 5a84ad03e..ed6a8b761 100644 --- a/test/FsAutoComplete.Tests.Lsp/CoreTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/CoreTests.fs @@ -37,6 +37,7 @@ let initTests createServer = let p: InitializeParams = { ProcessId = Some 1 RootPath = Some __SOURCE_DIRECTORY__ + Locale = None RootUri = None InitializationOptions = Some(Server.serialize defaultConfigDto) Capabilities = Some clientCaps @@ -58,9 +59,9 @@ let initTests createServer = Expect.equal res.Capabilities.CodeActionProvider - (Some + (Some (U2.Second { CodeActionOptions.ResolveProvider = None - CodeActionOptions.CodeActionKinds = None }) + CodeActionOptions.CodeActionKinds = None })) "Code Action Provider" Expect.equal @@ -74,7 +75,7 @@ let initTests createServer = Expect.equal res.Capabilities.DocumentLinkProvider None "Document Link Provider" Expect.equal res.Capabilities.DocumentOnTypeFormattingProvider None "Document OnType Formatting Provider" Expect.equal res.Capabilities.DocumentRangeFormattingProvider (Some true) "Document Range Formatting Provider" - Expect.equal res.Capabilities.DocumentSymbolProvider (Some true) "Document Symbol Provider" + Expect.equal res.Capabilities.DocumentSymbolProvider (Some (U2.Second { Label = Some "F#" })) "Document Symbol Provider" Expect.equal res.Capabilities.ExecuteCommandProvider None "Execute Command Provider" Expect.equal res.Capabilities.Experimental None "Experimental" Expect.equal res.Capabilities.HoverProvider (Some true) "Hover Provider" @@ -99,7 +100,7 @@ let initTests createServer = Expect.equal res.Capabilities.TextDocumentSync (Some td) "Text Document Provider" Expect.equal res.Capabilities.TypeDefinitionProvider (Some true) "Type Definition Provider" - Expect.equal res.Capabilities.WorkspaceSymbolProvider (Some true) "Workspace Symbol Provider" + Expect.equal res.Capabilities.WorkspaceSymbolProvider (Some (U2.Second { ResolveProvider = Some true })) "Workspace Symbol Provider" Expect.equal res.Capabilities.FoldingRangeProvider (Some true) "Folding Range Provider active" | Result.Error e -> failtest "Initialization failed" }) diff --git a/test/FsAutoComplete.Tests.Lsp/Helpers.fs b/test/FsAutoComplete.Tests.Lsp/Helpers.fs index 0fa3240fd..43cb71f0e 100644 --- a/test/FsAutoComplete.Tests.Lsp/Helpers.fs +++ b/test/FsAutoComplete.Tests.Lsp/Helpers.fs @@ -290,7 +290,9 @@ let clientCaps: ClientCapabilities = let symbolCaps: SymbolCapabilities = { DynamicRegistration = Some true - SymbolKind = None } + SymbolKind = None + TagSupport = None + ResolveSupport = None } let semanticTokenCaps: SemanticTokensWorkspaceClientCapabilities = { RefreshSupport = Some true } @@ -307,12 +309,17 @@ let clientCaps: ClientCapabilities = { ApplyEdit = Some true WorkspaceEdit = Some weCaps DidChangeConfiguration = Some dynCaps - DidChangeWatchedFiles = Some dynCaps + DidChangeWatchedFiles = None Symbol = Some symbolCaps SemanticTokens = Some semanticTokenCaps InlayHint = Some inlayHintCaps InlineValue = Some inlineValueCaps - CodeLens = Some codeLensCaps } + CodeLens = Some codeLensCaps + ExecuteCommand = Some dynCaps + WorkspaceFolders = Some false + Configuration = Some true + FileOperations = None + Diagnostics = Some { RefreshSupport = Some false } } let textCaps: TextDocumentClientCapabilities = let syncCaps: SynchronizationCapabilities = @@ -321,16 +328,26 @@ let clientCaps: ClientCapabilities = WillSaveWaitUntil = Some true DidSave = Some true } - let diagCaps: PublishDiagnosticsCapabilities = + let publishDiagCaps: PublishDiagnosticsCapabilities = let diagnosticTags: DiagnosticTagSupport = { ValueSet = [||] } { RelatedInformation = Some true - TagSupport = Some diagnosticTags } + TagSupport = Some diagnosticTags + VersionSupport = Some false + CodeDescriptionSupport = Some true + DataSupport = Some false } let ciCaps: CompletionItemCapabilities = { SnippetSupport = Some true CommitCharactersSupport = Some true - DocumentationFormat = None } + DocumentationFormat = None + DeprecatedSupport = Some false + PreselectSupport = Some false + TagSupport = None + InsertReplaceSupport = Some false + ResolveSupport = None + InsertTextModeSupport = None + LabelDetailsSupport = Some true } let cikCaps: CompletionItemKindCapabilities = { ValueSet = None } @@ -338,7 +355,11 @@ let clientCaps: ClientCapabilities = { DynamicRegistration = Some true CompletionItem = Some ciCaps CompletionItemKind = Some cikCaps - ContextSupport = Some true } + ContextSupport = Some true + InsertTextMode = Some InsertTextMode.AsIs + CompletionList = Some { + ItemDefaults = None + } } let hoverCaps: HoverCapabilities = { DynamicRegistration = Some true @@ -346,22 +367,29 @@ let clientCaps: ClientCapabilities = let sigCaps: SignatureHelpCapabilities = let siCaps: SignatureInformationCapabilities = - { DocumentationFormat = Some [| "markdown" |] } + { DocumentationFormat = Some [| "markdown" |] + ParameterInformation = Some { LabelOffsetSupport = Some true } + ActiveParameterSupport = Some true } { DynamicRegistration = Some true - SignatureInformation = Some siCaps } + SignatureInformation = Some siCaps + ContextSupport = Some true } let docSymCaps: DocumentSymbolCapabilities = let skCaps: SymbolKindCapabilities = { ValueSet = None } { DynamicRegistration = Some true SymbolKind = Some skCaps - HierarchicalDocumentSymbolSupport = Some false } + HierarchicalDocumentSymbolSupport = Some false + TagSupport = None + LabelSupport = Some true } let foldingRangeCaps: FoldingRangeCapabilities = { DynamicRegistration = Some true LineFoldingOnly = Some true - RangeLimit = Some 100 } + RangeLimit = Some 100 + FoldingRange = Some { CollapsedText = Some true } + FoldingRangeKind = None } let semanticTokensCaps: SemanticTokensClientCapabilities = { DynamicRegistration = Some true @@ -372,7 +400,9 @@ let clientCaps: ClientCapabilities = TokenModifiers = [||] Formats = [| TokenFormat.Relative |] OverlappingTokenSupport = None - MultilineTokenSupport = None } + MultilineTokenSupport = None + ServerCancelSupport = Some true + AugmentsSyntaxTokens = Some true } let codeActionCaps = { DynamicRegistration = Some true @@ -394,10 +424,39 @@ let clientCaps: ClientCapabilities = let renameCaps: RenameClientCapabilities = { DynamicRegistration = Some true HonorsChangeAnnotations = Some false - PrepareSupport = Some false } + PrepareSupport = Some false + PrepareSupportDefaultBehavior = Some PrepareSupportDefaultBehavior.Identifier } + + let linkCaps: DynamicLinkSupportCapabilities = + { DynamicRegistration = Some true + LinkSupport = Some false } + + let defCaps: DynamicLinkSupportCapabilities = + { DynamicRegistration = Some true + LinkSupport = Some false } + + let typeDefCaps: DynamicLinkSupportCapabilities = + { DynamicRegistration = Some true + LinkSupport = Some false } + + let implCaps: DynamicLinkSupportCapabilities = + { DynamicRegistration = Some true + LinkSupport = Some false } + + let docLinkCaps: DocumentLinkCapabilities = + { + DynamicRegistration = Some true + TooltipSupport = Some true + } + + let diagCaps: DiagnosticCapabilities = + { + DynamicRegistration = Some true + RelatedDocumentSupport = Some true + } { Synchronization = Some syncCaps - PublishDiagnostics = Some diagCaps + PublishDiagnostics = Some publishDiagCaps Completion = Some compCaps Hover = Some hoverCaps SignatureHelp = Some sigCaps @@ -407,24 +466,32 @@ let clientCaps: ClientCapabilities = Formatting = Some dynCaps RangeFormatting = Some dynCaps OnTypeFormatting = Some dynCaps - Definition = Some dynCaps + Definition = Some defCaps CodeAction = Some codeActionCaps CodeLens = Some dynCaps - DocumentLink = Some dynCaps + DocumentLink = Some docLinkCaps Rename = Some renameCaps FoldingRange = Some foldingRangeCaps SelectionRange = Some dynCaps SemanticTokens = Some semanticTokensCaps InlayHint = Some inlayHintCaps CallHierarchy = None - TypeHierarchy = None } - // InlineValue = Some inlineValueCaps } - + TypeHierarchy = None + Declaration = Some linkCaps + TypeDefinition = Some typeDefCaps + Implementation = Some implCaps + ColorProvider = Some dynCaps + LinkedEditingRange = Some dynCaps + Moniker = Some dynCaps + InlineValue = Some dynCaps + Diagnostic = Some diagCaps + } { Workspace = Some workspaceCaps TextDocument = Some textCaps Experimental = None - Window = None } + Window = None + General = None } open Expecto.Logging open Expecto.Logging.Message @@ -502,7 +569,8 @@ let serverInitialize path (config: FSharpConfigDto) createServer = Some [| { Uri = Path.FilePathToUri path Name = "Test Folder" } |] - trace = None } + trace = None + Locale = None } let! result = server.Initialize p diff --git a/test/FsAutoComplete.Tests.Lsp/SignatureHelpTests.fs b/test/FsAutoComplete.Tests.Lsp/SignatureHelpTests.fs index 8f54bd1f1..32174ed80 100644 --- a/test/FsAutoComplete.Tests.Lsp/SignatureHelpTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/SignatureHelpTests.fs @@ -67,7 +67,7 @@ let private functionApplicationEdgeCasesTests server = f 1 $0 // preserve last space """ Manual (fun resp -> match resp with - | Some sigHelp -> Expect.equal sigHelp.ActiveParameter (Some 1) "should have suggested the second parameter" + | Some sigHelp -> Expect.equal sigHelp.ActiveParameter (Some 1u) "should have suggested the second parameter" | None -> failwithf "There should be sighelp for this position") ptestCaseAsync "issue 745 - signature help shows tuples in parens" <| testSignatureHelp server """ diff --git a/test/FsAutoComplete.Tests.Lsp/Utils/Server.fs b/test/FsAutoComplete.Tests.Lsp/Utils/Server.fs index 0a3be94ab..79048a600 100644 --- a/test/FsAutoComplete.Tests.Lsp/Utils/Server.fs +++ b/test/FsAutoComplete.Tests.Lsp/Utils/Server.fs @@ -35,7 +35,7 @@ type Document = member doc.VersionedTextDocumentIdentifier: VersionedTextDocumentIdentifier = { Uri = doc.Uri - Version = Some doc.Version } + Version = doc.Version } member x.Diagnostics = x.Server.Events @@ -71,6 +71,7 @@ module Server = let p: InitializeParams = { ProcessId = Some 1 RootPath = path + Locale = None RootUri = path |> Option.map (sprintf "file://%s") InitializationOptions = Some(Server.serialize config) Capabilities = Some clientCaps @@ -306,7 +307,7 @@ module Document = doc // `fsharp/documentAnalyzed` signals all checks & analyzers done |> analyzedStream - |> Observable.filter (fun n -> n.TextDocument.Version = Some doc.Version) + |> Observable.filter (fun n -> n.TextDocument.Version = doc.Version) // wait for late diagnostics |> Observable.delay waitForLateDiagnosticsDelay ) @@ -325,10 +326,9 @@ module Document = System.Threading.Interlocked.Increment(&doc.Version) /// Note: Mutates passed `doc` - let private incrVersionedTextDocumentIdentifier (doc: Document) = + let private incrVersionedTextDocumentIdentifier (doc: Document): VersionedTextDocumentIdentifier = { Uri = doc.Uri - Version = Some(doc |> incrVersion) } - + Version = incrVersion doc } let openWith initialText (doc: Document) = async { diff --git a/test/FsAutoComplete.Tests.Lsp/Utils/TextEdit.fs b/test/FsAutoComplete.Tests.Lsp/Utils/TextEdit.fs index 741503e39..62372067b 100644 --- a/test/FsAutoComplete.Tests.Lsp/Utils/TextEdit.fs +++ b/test/FsAutoComplete.Tests.Lsp/Utils/TextEdit.fs @@ -498,11 +498,11 @@ module WorkspaceEdit = if uri <> textDocument.Uri then Some $"Edit should be for document `{textDocument.Uri}`, but was for `{uri}`" else - match textDocument.Version, version with - // only compare `Version` when `textDocument` and `version` has a Version. Otherwise ignore - | Some textDocVersion, Some version when textDocVersion <> version -> - Some $"Edit should be for document version `{textDocVersion}`, but version was `{version}`" - | _ -> None + if Some textDocument.Version <> version then + // only compare `Version` when `textDocument` and `version` has a Version. Otherwise ignore + Some $"Edit should be for document version `{textDocument.Version}`, but version was `{version}`" + else + None match (workspaceEdit.DocumentChanges, workspaceEdit.Changes) with | None, None -> diff --git a/test/FsAutoComplete.Tests.Lsp/XmlGenerationTests.fs b/test/FsAutoComplete.Tests.Lsp/XmlGenerationTests.fs index 242904652..4205c7ddd 100644 --- a/test/FsAutoComplete.Tests.Lsp/XmlGenerationTests.fs +++ b/test/FsAutoComplete.Tests.Lsp/XmlGenerationTests.fs @@ -48,7 +48,7 @@ let tests state = let! result = server.FSharpDocumentationGenerator( - { TextDocument = { Uri = fileUri; Version = Some 1 } + { TextDocument = { Uri = fileUri; Version = 1 } // the start of the 'add' symbol name Position = { Line = 0; Character = 5 } } ) From d215e7672fca1512281a7a729204c7c20a9a1d7b Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Fri, 28 Jul 2023 10:14:45 -0400 Subject: [PATCH 7/7] Various Fixes (#1148) --- src/FsAutoComplete.Core/Commands.fs | 2 +- src/FsAutoComplete.Core/FileSystem.fs | 2 - src/FsAutoComplete.Core/InlayHints.fs | 2 +- .../LspServers/AdaptiveFSharpLspServer.fs | 122 ++++++++++-------- 4 files changed, 72 insertions(+), 56 deletions(-) diff --git a/src/FsAutoComplete.Core/Commands.fs b/src/FsAutoComplete.Core/Commands.fs index cf8a5271e..424fea740 100644 --- a/src/FsAutoComplete.Core/Commands.fs +++ b/src/FsAutoComplete.Core/Commands.fs @@ -223,7 +223,7 @@ module Commands = } let docForText (lines: IFSACSourceText) (tyRes: ParseAndCheckResults) : Document = - { LineCount = lines.Lines.Length + { LineCount = lines.GetLineCount() FullName = tyRes.FileName // from the compiler, assumed safe GetText = fun _ -> string lines GetLineText0 = fun i -> (lines :> ISourceText).GetLineString i diff --git a/src/FsAutoComplete.Core/FileSystem.fs b/src/FsAutoComplete.Core/FileSystem.fs index 24921b977..f982ab127 100644 --- a/src/FsAutoComplete.Core/FileSystem.fs +++ b/src/FsAutoComplete.Core/FileSystem.fs @@ -482,8 +482,6 @@ module RoslynSourceText = let combineValues (values: seq<'T>) = (0, values) ||> Seq.fold (fun hash value -> combine (value.GetHashCode()) hash) - let weakTable = ConditionalWeakTable() - let rec create (fileName: string, sourceText: SourceText) : IFSACSourceText = let walk diff --git a/src/FsAutoComplete.Core/InlayHints.fs b/src/FsAutoComplete.Core/InlayHints.fs index 7cd7fb66a..724b4d9c8 100644 --- a/src/FsAutoComplete.Core/InlayHints.fs +++ b/src/FsAutoComplete.Core/InlayHints.fs @@ -977,7 +977,7 @@ let provideHints let line, _ = Position.toZ endPosForMethod let afterParenPosInLine = - getFirstPositionAfterParen (text.Lines.[line].ToString()) (endPosForMethod.Column) + getFirstPositionAfterParen (text.GetLineString(line)) (endPosForMethod.Column) let tupledParamInfos = parseAndCheck.GetParseResults.FindParameterLocations(Position.fromZ line afterParenPosInLine) diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index 5d0230d7d..dff95ca0a 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -289,6 +289,7 @@ type AdaptiveFSharpLspServer let filePathUntag = UMX.untag filePath let source = file.Source let version = file.Version + let fileName = Path.GetFileName filePathUntag let inline getSourceLine lineNo = @@ -298,7 +299,7 @@ type AdaptiveFSharpLspServer async { try use progress = new ServerProgressReport(lspClient) - do! progress.Begin("Checking unused opens...", message = filePathUntag) + do! progress.Begin($"Checking unused opens {fileName}...", message = filePathUntag) let! unused = UnusedOpens.getUnusedOpens (tyRes.GetCheckResults, getSourceLine) @@ -312,7 +313,7 @@ type AdaptiveFSharpLspServer async { try use progress = new ServerProgressReport(lspClient) - do! progress.Begin("Checking unused declarations...", message = filePathUntag) + do! progress.Begin($"Checking unused declarations {fileName}...", message = filePathUntag) let isScript = Utils.isAScript (filePathUntag) let! unused = UnusedDeclarations.getUnusedDeclarations (tyRes.GetCheckResults, isScript) @@ -328,7 +329,7 @@ type AdaptiveFSharpLspServer async { try use progress = new ServerProgressReport(lspClient) - do! progress.Begin("Checking simplifing of names...", message = filePathUntag) + do! progress.Begin($"Checking simplifing of names {fileName}...", message = filePathUntag) let! simplified = SimplifyNames.getSimplifiableNames (tyRes.GetCheckResults, getSourceLine) let simplified = Array.ofSeq simplified @@ -986,6 +987,23 @@ type AdaptiveFSharpLspServer // ignore if already cancelled () + [] + let rec (|Cancelled|_|) (e: exn) = + match e with + | :? TaskCanceledException -> ValueSome() + | :? OperationCanceledException -> ValueSome() + | :? System.AggregateException as aex -> + if aex.InnerExceptions.Count = 1 then + (|Cancelled|_|) aex.InnerException + else + ValueNone + | _ -> ValueNone + + let returnException e = + match e with + | Cancelled -> LspResult.requestCancelled + | e -> LspResult.internalError (string e) + let cachedFileContents = cmap, asyncaval> () let resetCancellationToken filePath = @@ -2094,7 +2112,7 @@ type AdaptiveFSharpLspServer with e -> trace |> Tracing.recordException e logger.error (Log.setMessage "HandleFormatting Request Errored {p}" >> Log.addExn e) - return! LspResult.internalError (string e) + return! returnException e } member __.ScriptFileProjectOptions = scriptFileProjectOptions.Publish @@ -2224,7 +2242,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.Initialized(p: InitializedParams) = @@ -2561,7 +2579,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.CompletionItemResolve(ci: CompletionItem) = @@ -2661,7 +2679,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentSignatureHelp(p: SignatureHelpParams) = @@ -2727,7 +2745,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentHover(p: TextDocumentPositionParams) = @@ -2824,7 +2842,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentPrepareRename p = @@ -2914,7 +2932,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentDefinition(p: TextDocumentPositionParams) = @@ -2944,7 +2962,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentTypeDefinition(p: TextDocumentPositionParams) = @@ -2974,7 +2992,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentReferences(p: ReferenceParams) = @@ -3010,7 +3028,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentDocumentHighlight(p: TextDocumentPositionParams) = @@ -3051,7 +3069,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -3125,7 +3143,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.TextDocumentDocumentSymbol(p: DocumentSymbolParams) = @@ -3162,7 +3180,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -3202,7 +3220,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentFormatting(p: DocumentFormattingParams) = @@ -3244,7 +3262,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentRangeFormatting(p: DocumentRangeFormattingParams) = @@ -3297,7 +3315,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -3364,7 +3382,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.TextDocumentCodeLens(p: CodeLensParams) = @@ -3402,7 +3420,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.CodeLensResolve(p: CodeLens) = @@ -3471,7 +3489,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } let writePayload (sourceFile: string, triggerPos: pos, usageLocations: range[]) = @@ -3641,7 +3659,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.TextDocumentSelectionRange(selectionRangeP: SelectionRangeParams) = @@ -3687,7 +3705,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentSemanticTokensFull(p: SemanticTokensParams) : AsyncLspResult = @@ -3713,7 +3731,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -3741,7 +3759,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentInlayHint(p: InlayHintParams) : AsyncLspResult = @@ -3846,7 +3864,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.TextDocumentInlineValue(p: InlineValueParams) = @@ -3888,7 +3906,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } //unsupported -- begin @@ -3999,7 +4017,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.FSharpSignatureData(p: TextDocumentPositionParams) = @@ -4036,7 +4054,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -4090,7 +4108,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FSharpLineLens(p: ProjectParms) = @@ -4122,7 +4140,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FSharpWorkspaceLoad(p: WorkspaceLoadParms) = @@ -4155,7 +4173,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -4193,7 +4211,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FSharpProject(p: ProjectParms) = @@ -4235,7 +4253,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -4271,7 +4289,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FSharpDotnetNewRun(p: DotnetNewRunRequest) = @@ -4300,7 +4318,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FSharpDotnetAddProject(p: DotnetProjectRequest) = @@ -4329,7 +4347,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FSharpDotnetRemoveProject(p: DotnetProjectRequest) = @@ -4358,7 +4376,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FSharpDotnetSlnAdd(p: DotnetProjectRequest) = @@ -4387,7 +4405,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.FSharpHelp(p: TextDocumentPositionParams) = @@ -4418,7 +4436,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.FSharpDocumentation(p: TextDocumentPositionParams) = @@ -4460,7 +4478,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.FSharpDocumentationSymbol(p: DocumentationForSymbolReuqest) = @@ -4506,7 +4524,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.LoadAnalyzers(path) = @@ -4560,7 +4578,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FsProjMoveFileUp(p: DotnetFileRequest) = @@ -4589,7 +4607,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -4619,7 +4637,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -4649,7 +4667,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FsProjAddFileBelow(p: DotnetFile2Request) = @@ -4678,7 +4696,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override __.FsProjRenameFile(p: DotnetRenameFileRequest) = @@ -4707,7 +4725,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } @@ -4737,7 +4755,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override _.FsProjRemoveFile(p: DotnetFileRequest) = @@ -4771,7 +4789,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override _.FsProjAddExistingFile(p: DotnetFileRequest) = @@ -4800,7 +4818,7 @@ type AdaptiveFSharpLspServer >> Log.addExn e ) - return! LspResult.internalError (string e) + return! returnException e } override x.Dispose() =