Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4f5e2c0

Browse files
vasily-kirichenkoKevin Ransom
authored and
Kevin Ransom
committed
fix ParseAndCheckDocument (#5175)
1 parentcc8b91c commit4f5e2c0

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

‎vsintegration/src/FSharp.Editor/LanguageService/FSharpCheckerExtensions.fs‎

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ open Microsoft.FSharp.Compiler
99
openMicrosoft.FSharp.Compiler.Ast
1010
openMicrosoft.FSharp.Compiler.SourceCodeServices
1111

12-
typeCheckResults=
13-
| Readyof(FSharpParseFileResults*FSharpCheckFileResults)option
14-
| StillRunningofAsync<(FSharpParseFileResults*FSharpCheckFileResults)option>
15-
1612
typeFSharpCheckerwith
1713
memberchecker.ParseDocument(document:Document,parsingOptions:FSharpParsingOptions,sourceText:string,userOpName:string)=
1814
asyncMaybe{
@@ -35,15 +31,14 @@ type FSharpChecker with
3531
Some(parseResults, checkFileResults)
3632
}
3733

38-
lettryGetFreshResultsWithTimeout():Async<CheckResults>=
39-
async{
40-
try
41-
let!worker= Async.StartChild(parseAndCheckFile,2000)
42-
let!result= worker
43-
return Ready result
44-
with:? TimeoutException->
45-
return StillRunning parseAndCheckFile
46-
}
34+
lettryGetFreshResultsWithTimeout()=
35+
async{
36+
let!worker= Async.StartChild(parseAndCheckFile, millisecondsTimeout=Settings.LanguageServicePerformance.TimeUntilStaleCompletion)
37+
try
38+
return! worker
39+
with:? TimeoutException->
40+
return None// worker is cancelled at this point, we cannot return it and wait its completion anymore
41+
}
4742

4843
letbindParsedInput(results:(FSharpParseFileResults* FSharpCheckFileResults)option)=
4944
match resultswith
@@ -59,18 +54,20 @@ type FSharpChecker with
5954

6055
let!results=
6156
match freshResultswith
62-
|Ready x-> async.Returnx
63-
|StillRunning worker->
57+
|Some x-> async.Return(Some x)
58+
|None->
6459
async{
6560
match checker.TryGetRecentCheckResultsForFile(filePath, options)with
6661
| Some(parseResults, checkFileResults,_)->
6762
return Some(parseResults, checkFileResults)
6863
| None->
69-
return!worker
64+
return!parseAndCheckFile
7065
}
7166
return bindParsedInput results
72-
}
73-
else parseAndCheckFile|> Async.map bindParsedInput
67+
else
68+
let!results= parseAndCheckFile
69+
return bindParsedInput results
70+
}
7471

7572

7673
memberchecker.ParseAndCheckDocument(document:Document,options:FSharpProjectOptions,allowStaleResults:bool,userOpName:string,?sourceText:SourceText)=

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp