11namespace rec JetBrains.ReSharper.Plugins.FSharp.Checker
22
3+ #nowarn " 57"
4+
35open System
46open System.Collections .Generic
57open System.IO
@@ -38,8 +40,7 @@ module FcsCheckerService =
3840
3941type FcsProject =
4042 { OutputPath: VirtualFileSystemPath
41- ProjectOptions: FSharpProjectOptions
42- ProjectSnapshot: FSharpProjectSnapshot option
43+ ProjectSnapshot: FSharpProjectSnapshot
4344 ParsingOptions: FSharpParsingOptions
4445 FileIndices: IDictionary < VirtualFileSystemPath , int >
4546 ImplementationFilesWithSignatures: ISet < VirtualFileSystemPath >
@@ -54,23 +55,26 @@ type FcsProject =
5455 tryGetValue path x.FileIndices |> Option.defaultValue - 1
5556
5657 member x.TestDump ( writer : TextWriter ) =
57- let projectOptions = x.ProjectOptions
58-
59- writer.WriteLine( $" Project file: {projectOptions.ProjectFileName}" )
60- writer.WriteLine( $" Stamp: {projectOptions.Stamp}" )
61- writer.WriteLine( $" Load time: {projectOptions.LoadTime}" )
62-
63- writer.WriteLine( " Source files:" )
64- for sourceFile in projectOptions.SourceFiles do
65- writer.WriteLine( $" {sourceFile}" )
66-
67- writer.WriteLine( " Other options:" )
68- for option in projectOptions.OtherOptions do
69- writer.WriteLine( $" {option}" )
58+ let projectSnapshot = x.ProjectSnapshot
59+ let ( ProjectSnapshot.FSharpProjectIdentifier ( projectFileName , _ )) = projectSnapshot.Identifier
7060
71- writer.WriteLine( " Referenced projects:" )
72- for referencedProject in projectOptions.ReferencedProjects do
73- writer.WriteLine( $" {referencedProject.OutputFile}" )
61+ writer.WriteLine( $" Project file: {projectFileName}" )
62+ // TODO: the ProjectSnapshot exposes less information than the ProjectOptions
63+
64+ // writer.WriteLine($"Stamp: {projectSnapshot.}")
65+ // writer.WriteLine($"Load time: {projectSnapshot.LoadTime}")
66+ //
67+ // writer.WriteLine("Source files:")
68+ // for sourceFile in projectSnapshot.SourceFiles do
69+ // writer.WriteLine($" {sourceFile}")
70+ //
71+ // writer.WriteLine("Other options:")
72+ // for option in projectSnapshot.OtherOptions do
73+ // writer.WriteLine($" {option}")
74+ //
75+ // writer.WriteLine("Referenced projects:")
76+ // for referencedProject in projectSnapshot.ReferencedProjects do
77+ // writer.WriteLine($" {referencedProject.OutputFile}")
7478
7579 writer.WriteLine()
7680
@@ -172,8 +176,8 @@ type FcsCheckerService(lifetime: Lifetime, logger: ILogger, onSolutionCloseNotif
172176 | None -> None
173177 | Some fcsProject ->
174178
175- let options = fcsProject.ProjectOptions
176- if not ( fcsProject.IsKnownFile( sourceFile)) && not options.UseScriptResolutionRules then None else
179+ let snapshot = fcsProject.ProjectSnapshot
180+ // if not (fcsProject.IsKnownFile(sourceFile)) && not options.UseScriptResolutionRules then None else
177181
178182 x.FcsProjectProvider.PrepareAssemblyShim( psiModule)
179183
@@ -182,7 +186,7 @@ type FcsCheckerService(lifetime: Lifetime, logger: ILogger, onSolutionCloseNotif
182186 logger.Trace( " ParseAndCheckFile: start {0}, {1}" , path, opName)
183187
184188 // todo: don't cancel the computation when file didn't change
185- match x.Checker.ParseAndCheckDocument( path, source , options , allowStaleResults, opName) .RunAsTask() with
189+ match x.Checker.ParseAndCheckDocument( path, snapshot , allowStaleResults, opName) .RunAsTask() with
186190 | Some ( parseResults, checkResults) ->
187191 logger.Trace( " ParseAndCheckFile: finish {0}, {1}" , path, opName)
188192 Some { ParseResults = parseResults; CheckResults = checkResults }
0 commit comments