From e8245d1ca48bf0721aa689d5e7038b11baafd28f Mon Sep 17 00:00:00 2001 From: nojaf Date: Mon, 4 Mar 2024 15:20:56 +0100 Subject: [PATCH] options.ReferencesOnDisk are not part of options.OtherOptions. --- .../FSharp/FSharp.Common/src/Checker/FcsCheckerService.fs | 6 ++++++ .../FSharp/FSharp.Common/src/Checker/FcsProjectProvider.fs | 1 + .../FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs | 1 + .../src/ProjectModel/FSharpScriptPsiModuleFactory.fs | 7 +++---- .../src/FSharp/FSharp.Tests.Host/FSharpTestHost.fs | 5 ++--- .../test/src/FSharp.Tests.Common/src/Common.fs | 1 + 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/FcsCheckerService.fs b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/FcsCheckerService.fs index 30ff149d7f..05700a3b92 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/FcsCheckerService.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/FcsCheckerService.fs @@ -70,6 +70,10 @@ type FcsProject = for option in projectSnapshot.OtherOptions do writer.WriteLine($" {option}") + writer.WriteLine("References on disk:") + for r in projectSnapshot.ReferencesOnDisk do + writer.WriteLine($" %s{r.Path}") + writer.WriteLine("Referenced projects:") for referencedProject in projectSnapshot.ReferencedProjects do writer.WriteLine($" {referencedProject.OutputFile}") @@ -97,6 +101,7 @@ type FcsCheckerService(lifetime: Lifetime, logger: ILogger, onSolutionCloseNotif let setting = SettingsUtil.getEntry settingsStore name settingsStoreLive.GetValueProperty(lifetime, setting, null) + // Hard coded for now. let useTransparentCompiler = true // (getSettingProperty "UseTransparentCompiler").Value @@ -180,6 +185,7 @@ type FcsCheckerService(lifetime: Lifetime, logger: ILogger, onSolutionCloseNotif x.FcsProjectProvider.PrepareAssemblyShim(psiModule) + // TODO: should this be the non virtual path? let path = sourceFile.GetLocation().FullPath let source = FcsCheckerService.getSourceText sourceFile.Document logger.Trace("ParseAndCheckFile: start {0}, {1}", path, opName) diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/FcsProjectProvider.fs b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/FcsProjectProvider.fs index 7a11477221..8ac241d919 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/FcsProjectProvider.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/FcsProjectProvider.fs @@ -135,6 +135,7 @@ type FcsProjectProvider(lifetime: Lifetime, solution: ISolution, changeManager: newOptions.ProjectFileName = oldOptions.ProjectFileName && newOptions.SourceFiles = oldOptions.SourceFiles && newOptions.OtherOptions = oldOptions.OtherOptions && + newOptions.ReferencesOnDisk = oldOptions.ReferencesOnDisk && newOptions.ReferencedProjects.Length = oldOptions.ReferencedProjects.Length && (newOptions.ReferencedProjects, oldOptions.ReferencedProjects) diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs index efcec4e381..2211c1f1f2 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs @@ -196,6 +196,7 @@ type ScriptFcsProjectProvider(lifetime: Lifetime, logger: ILogger, checkerServic List.length l1 = List.length l2 && List.forall2 (=) l1 l2 listEq options1.OtherOptions options2.OtherOptions && + listEq options1.ReferencesOnDisk options2.ReferencesOnDisk && listEq options1.SourceFiles options2.SourceFiles if not (areEqualForChecking oldOptions.ProjectSnapshot newSnapshot) then diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/ProjectModel/FSharpScriptPsiModuleFactory.fs b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/ProjectModel/FSharpScriptPsiModuleFactory.fs index 3e1f7d4a9d..6a0cba7300 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/ProjectModel/FSharpScriptPsiModuleFactory.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/ProjectModel/FSharpScriptPsiModuleFactory.fs @@ -68,10 +68,9 @@ type FSharpScriptPsiModulesProvider(lifetime: Lifetime, solution: ISolution, cha let getScriptReferences (scriptPath: VirtualFileSystemPath) (scriptSnapshot: FSharpProjectSnapshot) = let assembliesPaths = HashSet() - for o in scriptSnapshot.OtherOptions do - if o.StartsWith("-r:", StringComparison.Ordinal) then - let path = VirtualFileSystemPath.TryParse(o.Substring(3), InteractionContext.SolutionContext) - if not path.IsEmpty then assembliesPaths.Add(path) |> ignore + for { Path = r } in scriptSnapshot.ReferencesOnDisk do + let path = VirtualFileSystemPath.TryParse(r, InteractionContext.SolutionContext) + if not path.IsEmpty then assembliesPaths.Add(path) |> ignore let filesPaths = HashSet() for file in scriptSnapshot.SourceFiles do diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Tests.Host/FSharpTestHost.fs b/ReSharper.FSharp/src/FSharp/FSharp.Tests.Host/FSharpTestHost.fs index dd2e9eebd2..be86e9e164 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Tests.Host/FSharpTestHost.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Tests.Host/FSharpTestHost.fs @@ -56,9 +56,8 @@ type FSharpTestHost(solution: ISolution, sourceCache: FSharpSourceCache, itemsCo projectProvider.GetProjectSnapshot(sourceFile) |> Option.map (fun options -> - options.OtherOptions - |> List.choose (fun o -> if o.StartsWith("-r:") then Some (o.Substring("-r:".Length)) else None) - |> List.map (fun p -> VirtualFileSystemPath.TryParse(p, InteractionContext.SolutionContext)) + options.ReferencesOnDisk + |> List.map (fun { Path = p } -> VirtualFileSystemPath.TryParse(p, InteractionContext.SolutionContext)) |> List.filter (fun p -> not p.IsEmpty && directory.IsPrefixOf(p)) |> List.map (fun p -> p.Name) |> List) diff --git a/ReSharper.FSharp/test/src/FSharp.Tests.Common/src/Common.fs b/ReSharper.FSharp/test/src/FSharp.Tests.Common/src/Common.fs index 84e1e03d86..9f7894f215 100644 --- a/ReSharper.FSharp/test/src/FSharp.Tests.Common/src/Common.fs +++ b/ReSharper.FSharp/test/src/FSharp.Tests.Common/src/Common.fs @@ -247,6 +247,7 @@ type TestFcsProjectProvider(lifetime: Lifetime, checkerService: FcsCheckerServic newOptions.ProjectFileName = oldOptions.ProjectFileName && newOptions.SourceFiles = oldOptions.SourceFiles && newOptions.OtherOptions = oldOptions.OtherOptions && + newOptions.ReferencesOnDisk = oldOptions.ReferencesOnDisk && getReferencedProjectOutputs newOptions = getReferencedProjectOutputs oldOptions let getFcsProject (psiModule: IPsiModule) =