@@ -9,10 +9,6 @@ open Microsoft.FSharp.Compiler
99open Microsoft.FSharp .Compiler .Ast
1010open Microsoft.FSharp .Compiler .SourceCodeServices
1111
12- type CheckResults =
13- | Readyof ( FSharpParseFileResults * FSharpCheckFileResults ) option
14- | StillRunningof Async <( FSharpParseFileResults * FSharpCheckFileResults ) option >
15-
1612type FSharpChecker with
1713member checker.ParseDocument ( document : Document , parsingOptions : FSharpParsingOptions , sourceText : string , userOpName : string ) =
1814asyncMaybe {
@@ -36,15 +32,13 @@ type FSharpChecker with
3632 Some( parseResults, checkFileResults)
3733}
3834
39- let! worker = Async.StartChild( parseAndCheckFile, millisecondsTimeout= Settings.LanguageServicePerformance.TimeUntilStaleCompletion)
40-
41- let tryGetFreshResultsWithTimeout () : Async < CheckResults > =
35+ let tryGetFreshResultsWithTimeout () =
4236async {
37+ let! worker = Async.StartChild( parseAndCheckFile, millisecondsTimeout= Settings.LanguageServicePerformance.TimeUntilStaleCompletion)
4338try
44- let! result = worker
45- return Ready result
39+ return ! worker
4640 with: ? TimeoutException ->
47- return StillRunning worker
41+ return None // worker is cancelled at this point, we cannot return it and wait its completion anymore
4842}
4943
5044let bindParsedInput ( results : ( FSharpParseFileResults * FSharpCheckFileResults )option ) =
@@ -60,19 +54,19 @@ type FSharpChecker with
6054
6155let! results =
6256match freshResultswith
63- | Ready x-> async.Returnx
64- | StillRunning worker ->
57+ | Some x-> async.Return( Some x )
58+ | None ->
6559async {
6660match checker.TryGetRecentCheckResultsForFile( filePath, options) with
6761| Some( parseResults, checkFileResults, _) ->
6862return Some( parseResults, checkFileResults)
6963| None->
70- return ! worker
64+ return ! parseAndCheckFile
7165}
7266return bindParsedInput results
7367else
74- let! res = worker
75- return bindParsedInputres
68+ let! results = parseAndCheckFile
69+ return bindParsedInputresults
7670}
7771
7872