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

Commit3a68884

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
Try to make completion faster (dotnet#2315)
* use TryGetRecentCheckResultsForFile to get potentially stale file check results* wip* make GetDeclarationListInfo "threadSafeOp" instead of "reactorOp"* make QuickInfo description and signature help synchronous* Revert "make QuickInfo description and signature help synchronous"This reverts commit2f0ad0f.* remove reactor ops from FSharpFileCheckResults* reduce incrementalTypeCheckCacheSize from 5 to 3refactoring* Revert "remove reactor ops from FSharpFileCheckResults"This reverts commitc068581.* use incremental file checking* revert last bits to reactor* refactor CompletionProvider* TypeCheckOneFile works incrementally, processing Eventually with Reactor bit-by-bit* combine CheckOneFile reactor ops into 50 ms slices approx* pass allowStaleResults explicitly* make ParseAndCheckInteraction async* remove CancellationToken from repeatedlyProgressUntilDoneOrTimeShareOver(OrCanceled)remove explicit CancellationToken from forceAsync* FSharpChecker.ParseAndCheckDocument tries to get fresh check results for 2 seconds, then uses stale ones, if the caller permits it, then continue waiting for fresh ones, if there is no stale results* revert cancellation token to repeatedlyProgressUntilDoneOrTimeShareOverOrCanceled* fix the semaphore* use Async.StartChild with timeout, which is automatically cancelled by timeout* refactor ParseAndCheckDocument* store TcResolutions.CapturedEnvs indexed by line* remove unnecessary execWithReactorAsync for methods already protected with BackgroundCompiler.locked* add beingCheckedFileCache* fix Logging crash in tests* extract CheckOneFile* Revert "store TcResolutions.CapturedEnvs indexed by line"This reverts commit30c9bcf.* remove logging* spin faster* address code review* add "VFT_GetFreshFileCheckResultsTimeoutMillis" environment variable to control how much we wait for fresh file type check results until falling to use cached ones* proper Equals for beingCheckedFileTable* fixed: CheckFileInProjectIfReady does not call ImplicitlyStartCheckProjectInBackground no matter what, as before* remove unused parameter from tryGetFreshResultsWithTimeout* remove logging
1 parentd6408d7 commit3a68884

File tree

21 files changed

+499
-331
lines changed

21 files changed

+499
-331
lines changed

‎src/absil/illib.fs‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,15 @@ module ResultOrException =
494494
/// captured by the NotYetDone closure. Computations do not need to be restartable.
495495
///
496496
/// - The key thing is that you can take an Eventually value and run it with
497-
/// Eventually.repeatedlyProgressUntilDoneOrTimeShareOver
497+
/// Eventually.repeatedlyProgressUntilDoneOrTimeShareOverOrCanceled
498498
typeEventually<'T>=
499499
| Doneof'T
500500
| NotYetDoneof(unit->Eventually<'T>)
501501

502502
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
503503
moduleEventually=
504+
openSystem.Threading
505+
504506
let recbox e=
505507
match ewith
506508
| Done x-> Done(Operators.box x)
@@ -515,10 +517,11 @@ module Eventually =
515517
else forceWhile check(work())
516518

517519
letforce e= Option.get(forceWhile(fun()->true) e)
520+
518521

519522
/// Keep running the computation bit by bit until a time limit is reached.
520523
/// The runner gets called each time the computation is restarted
521-
letrepeatedlyProgressUntilDoneOrTimeShareOver timeShareInMilliseconds runner e=
524+
letrepeatedlyProgressUntilDoneOrTimeShareOverOrCanceled timeShareInMilliseconds(ct:CancellationToken)runner e=
522525
letsw=new System.Diagnostics.Stopwatch()
523526
let recrunTimeShare e=
524527
runner(fun()->
@@ -527,14 +530,27 @@ module Eventually =
527530
let recloop(e)=
528531
match ewith
529532
| Done_-> e
530-
| NotYetDone work->
531-
if sw.ElapsedMilliseconds> timeShareInMillisecondsthen
533+
| NotYetDone work->
534+
ifct.IsCancellationRequested||sw.ElapsedMilliseconds> timeShareInMillisecondsthen
532535
sw.Stop();
533536
NotYetDone(fun()-> runTimeShare e)
534537
else
535538
loop(work())
536539
loop(e))
537540
runTimeShare e
541+
542+
/// Keep running the asynchronous computation bit by bit. The runner gets called each time the computation is restarted.
543+
/// Can be cancelled in the normal way.
544+
letforceAsync(runner:(unit-> Eventually<'T>)->Async<Eventually<'T>>)(e:Eventually<'T>):Async<'Toption>=
545+
let recloop(e:Eventually<'T>)=
546+
async{
547+
match ewith
548+
| Done x->return Some x
549+
| NotYetDone work->
550+
let!r= runner work
551+
return! loop r
552+
}
553+
loop e
538554

539555
let recbind k e=
540556
match ewith

‎src/fsharp/vs/IncrementalBuild.fs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,9 @@ type internal CompilationErrorLogger (debugName:string, tcConfig:TcConfig) =
11611161
[for(e,isError)in diagnostics-> e,(if isErrorthen FSharpErrorSeverity.Errorelse FSharpErrorSeverity.Warning)]
11621162

11631163

1164-
/// This represents the global state established as each task function runs as part of the build
1164+
/// This represents the global state established as each task function runs as part of the build.
11651165
///
1166-
/// Use to reset error and warning handlers
1166+
/// Use to reset error and warning handlers.
11671167
typeCompilationGlobalsScope(errorLogger:ErrorLogger,phase,projectDirectory)=
11681168
do ignore projectDirectory
11691169
letunwindEL= PushErrorLoggerPhaseUntilUnwind(fun _-> errorLogger)
@@ -1497,8 +1497,9 @@ type IncrementalBuilder(frameworkTcImportsCache: FrameworkImportsCache, tcConfig
14971497
if ensureReactivethen
14981498
lettimeSlicedComputation=
14991499
fullComputation|>
1500-
Eventually.repeatedlyProgressUntilDoneOrTimeShareOver
1500+
Eventually.repeatedlyProgressUntilDoneOrTimeShareOverOrCanceled
15011501
maxTimeShareMilliseconds
1502+
CancellationToken.None
15021503
(fun f->
15031504
// Reinstall the compilation globals each time we start or restart
15041505
use unwind=new CompilationGlobalsScope(errorLogger, BuildPhase.TypeCheck, projectDirectory)

‎src/fsharp/vs/IncrementalBuild.fsi‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,9 @@ module internal IncrementalBuild =
279279
/// Set the conrete inputs for this build.
280280
memberGetInitialPartialBuild:vectorinputs:BuildInput list->PartialBuild
281281

282+
/// This represents the global state established as each task function runs as part of the build.
283+
///
284+
/// Use to reset error and warning handlers.
285+
type internal CompilationGlobalsScope=
286+
new: ErrorLogger* BuildPhase* string-> CompilationGlobalsScope
287+
interface IDisposable

‎src/fsharp/vs/ServiceDeclarations.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,7 @@ type FSharpDeclarationListItem(name: string, nameInCode: string, glyphMajor: Gly
13101310
match infowith
13111311
| Choice1Of2(items, infoReader, m, denv, reactor:IReactorOperations, checkAlive)->
13121312
// reactor causes the lambda to execute on the background compiler thread, through the Reactor
1313-
reactor.EnqueueAndAwaitOpAsync("DescriptionTextAsync",fun _ct->
1313+
reactor.EnqueueAndAwaitOpAsync("StructuredDescriptionTextAsync",fun _ct->
13141314
// This is where we do some work which may touch TAST data structures owned by the IncrementalBuilder - infoReader, item etc.
13151315
// It is written to be robust to a disposal of an IncrementalBuilder, in which case it will just return the empty string.
13161316
// It is best to think of this as a "weak reference" to the IncrementalBuilder, i.e. this code is written to be robust to its

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp