@@ -22,7 +22,7 @@ open Microsoft.VisualStudio
2222open FSharp.Compiler .Text
2323open Microsoft.VisualStudio .TextManager .Interop
2424
25- #nowarn 57
25+ #nowarn " 57 "
2626
2727[<AutoOpen>]
2828module private FSharpProjectOptionsHelpers =
@@ -200,9 +200,11 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) =
200200 cancellableTask {
201201 let! ct = CancellableTask.getCancellationToken ()
202202 let! fileStamp = document.GetTextVersionAsync( ct)
203+
203204 match singleFileCache.TryGetValue( document.Id) with
204205 | false , _ ->
205206 let! sourceText = document.GetTextAsync( ct)
207+
206208 let getProjectOptionsFromScript textViewAndCaret =
207209 match textViewAndCaret with
208210 | None ->
@@ -214,19 +216,20 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) =
214216 userOpName = userOpName
215217 )
216218
217- | Some (_, caret) ->
218- checker.GetProjectOptionsFromScript(
219- document.FilePath,
220- sourceText.ToFSharpSourceText(),
221- caret,
222- previewEnabled = SessionsProperties.fsiPreview,
223- assumeDotNetFramework = not SessionsProperties.fsiUseNetCore,
224- userOpName = userOpName
225- )
219+ | Some(_, caret) ->
220+ checker.GetProjectOptionsFromScript(
221+ document.FilePath,
222+ sourceText.ToFSharpSourceText(),
223+ caret,
224+ previewEnabled = SessionsProperties.fsiPreview,
225+ assumeDotNetFramework = not SessionsProperties.fsiUseNetCore,
226+ userOpName = userOpName
227+ )
226228
227229 let textViewAndCaret = document.TryGetTextViewAndCaretPos()
228230 let! scriptProjectOptions , _ = getProjectOptionsFromScript textViewAndCaret
229231 let project = document.Project
232+
230233 let otherOptions =
231234 if project.IsFSharpMetadata then
232235 project.ProjectReferences
@@ -264,28 +267,34 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) =
264267 let updateProjectOptions () =
265268 async {
266269 let! scriptProjectOptions , _ = getProjectOptionsFromScript None
267- checker.NotifyFileChanged( document.FilePath, scriptProjectOptions) |> Async.Start
268- } |> Async.Start
270+
271+ checker.NotifyFileChanged( document.FilePath, scriptProjectOptions)
272+ |> Async.Start
273+ }
274+ |> Async.Start
269275
270276 let onChangeCaretHandler ( _ , _newline : int , _oldline : int ) = updateProjectOptions ()
271- let onKillFocus ( _ ) = updateProjectOptions ()
272- let onSetFocus ( _ ) = updateProjectOptions ()
277+ let onKillFocus ( _ ) = updateProjectOptions ()
278+ let onSetFocus ( _ ) = updateProjectOptions ()
273279
274280 let addToCacheAndSubscribe value =
275281 match value with
276282 | projectId, fileStamp, parsingOptions, projectOptions, _ ->
277283 let subscription =
278284 match textViewAndCaret with
279- | Some ( textView, _) -> subscribeToTextViewEvents( textView, ( Some onChangeCaretHandler), ( Some onKillFocus), ( Some onSetFocus))
285+ | Some( textView, _) ->
286+ subscribeToTextViewEvents ( textView, ( Some onChangeCaretHandler), ( Some onKillFocus), ( Some onSetFocus))
280287 | None -> None
288+
281289 ( projectId, fileStamp, parsingOptions, projectOptions, subscription)
282290
283291 singleFileCache.AddOrUpdate(
284- document.Id, // The key to the cache
285- ( fun _ value -> addToCacheAndSubscribe value), // Function to add the cached value if the key does not exist
286- ( fun _ _ value -> value), // Function to update the value if the key exists
287- ( document.Project, fileStamp, parsingOptions, projectOptions, None) // The value to add or update
288- ) |> ignore
292+ document.Id, // The key to the cache
293+ ( fun _ value -> addToCacheAndSubscribe value), // Function to add the cached value if the key does not exist
294+ ( fun _ _ value -> value), // Function to update the value if the key exists
295+ ( document.Project, fileStamp, parsingOptions, projectOptions, None) // The value to add or update
296+ )
297+ |> ignore
289298
290299 return ValueSome( parsingOptions, projectOptions)
291300
@@ -294,6 +303,7 @@ type private FSharpProjectOptionsReactor(checker: FSharpChecker) =
294303 match singleFileCache.TryRemove( document.Id) with
295304 | true , (_, _, _, _, Some subscription) -> subscription.Dispose()
296305 | _ -> ()
306+
297307 return ! tryComputeOptionsBySingleScriptOrFile document userOpName
298308 else
299309 return ValueSome( parsingOptions, projectOptions)
0 commit comments