@@ -115,15 +115,16 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
115115 let cpsCommandLineOptions = new ConcurrentDictionary< ProjectId, string[] * string[]>()
116116
117117 let cache = Dictionary< ProjectId, Project * FSharpParsingOptions * FSharpProjectOptions>()
118- let singleFileCache = Dictionary< DocumentId, VersionStamp * FSharpParsingOptions * FSharpProjectOptions>()
118+ let singleFileCache = Dictionary< DocumentId, VersionStamp * DateTime * FSharpParsingOptions * FSharpProjectOptions>()
119119
120- let rec tryComputeOptionsByFile ( document : Document ) cancellationToken =
120+ let rec tryComputeOptionsByFile ( document : Document ) cancellationToken ( loadTime : DateTime option ) =
121121 async {
122- let! sourceText = document.GetTextAsync( cancellationToken) |> Async.AwaitTask
123122 let! fileStamp = document.GetTextVersionAsync( cancellationToken) |> Async.AwaitTask
124- let! scriptProjectOptions , _ = checkerProvider.Checker.GetProjectOptionsFromScript( document.FilePath, sourceText.ToFSharpSourceText(), DateTime.Now)
125123 match singleFileCache.TryGetValue( document.Id) with
126124 | false , _ ->
125+ let! sourceText = document.GetTextAsync( cancellationToken) |> Async.AwaitTask
126+ let loadTime = defaultArg loadTime DateTime.Now
127+ let! scriptProjectOptions , _ = checkerProvider.Checker.GetProjectOptionsFromScript( document.FilePath, sourceText.ToFSharpSourceText(), loadTime)
127128 let projectOptions =
128129 if isScriptFile document.FilePath then
129130 scriptProjectOptions
@@ -145,18 +146,18 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
145146
146147 cancellationToken.ThrowIfCancellationRequested()
147148
148- checkerProvider.Checker.InvalidateConfiguration ( projectOptions, startBackgroundCompileIfAlreadySeen = true , userOpName = " computeOptions " )
149+ checkerProvider.Checker.CheckProjectInBackground ( projectOptions, userOpName= " checkOptions " )
149150
150151 let parsingOptions , _ = checkerProvider.Checker.GetParsingOptionsFromProjectOptions( projectOptions)
151152
152- singleFileCache.[ document.Id] <- ( fileStamp, parsingOptions, projectOptions)
153+ singleFileCache.[ document.Id] <- ( fileStamp, loadTime , parsingOptions, projectOptions)
153154
154155 return Some( parsingOptions, projectOptions)
155156
156- | true , ( fileStamp2, parsingOptions, projectOptions) ->
157+ | true , ( fileStamp2, loadTime2 , parsingOptions, projectOptions) ->
157158 if fileStamp <> fileStamp2 then
158159 singleFileCache.Remove( document.Id) |> ignore
159- return ! tryComputeOptionsByFile document cancellationToken
160+ return ! tryComputeOptionsByFile document cancellationToken ( Some loadTime2 )
160161 else
161162 return Some( parsingOptions, projectOptions)
162163 }
@@ -259,7 +260,7 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
259260 if document.Project.Solution.Workspace.Kind = WorkspaceKind.MiscellaneousFiles then
260261 reply.Reply( None)
261262 elif document.Project.Name = FSharpConstants.FSharpMiscellaneousFilesName then
262- let! options = tryComputeOptionsByFile document cancellationToken
263+ let! options = tryComputeOptionsByFile document cancellationToken None
263264 reply.Reply( options)
264265 else
265266 let! options = tryComputeOptions document.Project cancellationToken
0 commit comments