From 20b67ad663df9b563e821bb1cfaecd97fd8282ea Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Tue, 30 Apr 2024 10:07:23 -0400 Subject: [PATCH] Main to nightly (#1279) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Shift multiline paren contents less aggressively (#1242) * Shift multiline paren contents less aggressively * Make it actually work * Disambiguate AsSpan overload * Add some code fixes for type mismatch. (#1250) * Migrate FAKE to Fun.Build (#1256) * Migrate FAKE to Fun.Build * Add default Build pipeline. * Purge it with fire (#1255) * Bump analyzers and Fantomas (#1257) * Add empty, disabled tests for go-to-def on C# symbol scenario * fix unicode characters in F# compiler diagnostic messages (#1265) * fix unicode chars in F# compiler diagnostic messages * fix typo in ShadowedTimeouts focused tests * fixup! fix unicode chars in F# compiler diagnostic messages * remove focused tests... * remove debug prints Co-authored-by: Jimmy Byrd --------- Co-authored-by: Jimmy Byrd * - remove an ignored call to protocolRangeToRange (#1266) - remove an ignored instance of StreamJsonRpcTracingStrategy * Place XML doc lines before any attribute lists (#1267) * Don't generate params for explicit getters/setters as they are flagged invalid by the compiler (#1268) * bump ProjInfo to the next version to get support for loading broken projects and loading traversal projects (#1270) * only allow one GetProjectOptionsFromScript at a time (#1275) https://github.com/ionide/ionide-vscode-fsharp/issues/2005 * changelog for v0.72.0 * changelog for v0.72.1 * Use actualRootPath instead of p.RootPath when peeking workspaces. (#1278) This fix the issue where rootUri was ignored when using AutomaticWorkspaceInit. * changelog for v0.72.2 --------- Co-authored-by: Brian Rourke Boll Co-authored-by: Florian Verdonck Co-authored-by: Krzysztof Cieślak Co-authored-by: MrLuje Co-authored-by: dawe Co-authored-by: Chet Husk Co-authored-by: oupson <31827294+oupson@users.noreply.github.com> --- CHANGELOG.md | 28 ++++++++++++++++- .../CompilerServiceInterface.fs | 31 ++++++++++++++----- .../LspServers/AdaptiveFSharpLspServer.fs | 9 ++---- 3 files changed, 54 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b283d9487..ffbb4edb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,32 @@ # Changelog -## Unreleased +## [0.72.2] - 2024-04-30 + +### Fixed + +* [Use actualRootPath instead of p.RootPath when peeking workspaces](https://github.com/ionide/FsAutoComplete/pull/1278) (thanks @oupson) + +## [0.72.1] - 2024-04-25 + +### Added + +* [Show additional diagnostics specific to script files](https://github.com/ionide/FsAutoComplete/pull/1248) (thanks @TheAngryByrd) +* [Add some code fixes for type mismatch](https://github.com/ionide/FsAutoComplete/pull/1250) (thanks @nojaf) + +### Fixed + +* [Shift multiline paren contents less aggressively](https://github.com/ionide/FsAutoComplete/pull/1242) (thanks @brianrourkeboll) +* [fix unicode characters in F# compiler diagnostic messages](https://github.com/ionide/FsAutoComplete/pull/1265) (thanks @MrLuje) +* [Place XML doc lines before any attribute lists](https://github.com/ionide/FsAutoComplete/pull/1267) (thanks @dawedawe) +* [Don't generate params for explicit getters/setters](https://github.com/ionide/FsAutoComplete/pull/1268) (thanks @dawedawe) +* [Fix Nuget Script Restores when doing them in parallel](https://github.com/ionide/FsAutoComplete/pull/1275) (thanks @TheAngryByrd) + +### Changed + +* [Migrate Codefix Scaffolding](https://github.com/ionide/FsAutoComplete/pull/1256) (thanks @nojaf) +* [Bump ProjInfo to 0.64.0](https://github.com/ionide/FsAutoComplete/pull/1270) Check out the [release notes](https://github.com/ionide/proj-info/releases/tag/v0.64.0) for more details (thanks @baronfel) + * Fixes Loading Projects in some cases + * Adds Traversal Project support ## [0.71.0] - 2024-03-07 diff --git a/src/FsAutoComplete.Core/CompilerServiceInterface.fs b/src/FsAutoComplete.Core/CompilerServiceInterface.fs index 5ff3049c5..937d5d090 100644 --- a/src/FsAutoComplete.Core/CompilerServiceInterface.fs +++ b/src/FsAutoComplete.Core/CompilerServiceInterface.fs @@ -13,7 +13,7 @@ open Microsoft.Extensions.Caching.Memory open System open FsToolkit.ErrorHandling open FSharp.Compiler.CodeAnalysis.ProjectSnapshot - +open System.Threading type Version = int @@ -97,6 +97,10 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe let entityCache = EntityCache() + // FCS can't seem to handle parallel project restores for script files + // https://github.com/ionide/ionide-vscode-fsharp/issues/2005 + let scriptLocker = new SemaphoreSlim(1, 1) + // This is used to hold previous check results for autocompletion. // We can't seem to rely on the checker for previous cached versions let memoryCache () = @@ -319,10 +323,16 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe } member self.GetProjectSnapshotsFromScript(file: string, source, tfm: FSIRefs.TFM) = - match tfm with - | FSIRefs.TFM.NetFx -> self.GetNetFxScriptSnapshot(file, source) - | FSIRefs.TFM.NetCore -> self.GetNetCoreScriptSnapshot(file, source) + async { + try + do! scriptLocker.WaitAsync() |> Async.AwaitTask + match tfm with + | FSIRefs.TFM.NetFx -> return! self.GetNetFxScriptSnapshot(file, source) + | FSIRefs.TFM.NetCore -> return! self.GetNetCoreScriptSnapshot(file, source) + finally + scriptLocker.Release() |> ignore + } member private __.GetNetFxScriptOptions(file: string, source) = @@ -394,9 +404,16 @@ type FSharpCompilerServiceChecker(hasAnalyzers, typecheckCacheSize, parallelRefe } member self.GetProjectOptionsFromScript(file: string, source, tfm) = - match tfm with - | FSIRefs.TFM.NetFx -> self.GetNetFxScriptOptions(file, source) - | FSIRefs.TFM.NetCore -> self.GetNetCoreScriptOptions(file, source) + async { + try + do! scriptLocker.WaitAsync() |> Async.AwaitTask + + match tfm with + | FSIRefs.TFM.NetFx -> return! self.GetNetFxScriptOptions(file, source) + | FSIRefs.TFM.NetCore -> return! self.GetNetCoreScriptOptions(file, source) + finally + scriptLocker.Release() |> ignore + } diff --git a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs index 6dd3e482e..5a7757b0a 100644 --- a/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs +++ b/src/FsAutoComplete/LspServers/AdaptiveFSharpLspServer.fs @@ -319,15 +319,12 @@ type AdaptiveFSharpLspServer | None -> p.RootPath let projs = - match p.RootPath, c.AutomaticWorkspaceInit with + match actualRootPath, c.AutomaticWorkspaceInit with | None, _ | _, false -> state.WorkspacePaths - | Some actualRootPath, true -> + | Some rootPath, true -> let peeks = - WorkspacePeek.peek - actualRootPath - c.WorkspaceModePeekDeepLevel - (c.ExcludeProjectDirectories |> List.ofArray) + WorkspacePeek.peek rootPath c.WorkspaceModePeekDeepLevel (c.ExcludeProjectDirectories |> List.ofArray) |> List.map Workspace.mapInteresting |> List.sortByDescending (fun x -> match x with