Problem
Project.FindFSharpReferencesAsync launches one CancellableTask per document in the project simultaneously via CancellableTask.whenAll, which can spawn an unbounded number of parallel typechecks at once when a project has many documents. This causes CPU spikes and background churn during Find All References / Rename.
Fix
Add CancellableTask.whenAllThrottled maxDegreeOfParallelism, which uses a SemaphoreSlim to cap the number of concurrently running tasks while preserving cancellation semantics. Apply it in Project.FindFSharpReferencesAsync (in WorkspaceExtensions.fs), capping concurrency to max 1 Environment.ProcessorCount.
Files
vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs
vsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs
Problem
Project.FindFSharpReferencesAsynclaunches oneCancellableTaskper document in the project simultaneously viaCancellableTask.whenAll, which can spawn an unbounded number of parallel typechecks at once when a project has many documents. This causes CPU spikes and background churn during Find All References / Rename.Fix
Add
CancellableTask.whenAllThrottled maxDegreeOfParallelism, which uses aSemaphoreSlimto cap the number of concurrently running tasks while preserving cancellation semantics. Apply it inProject.FindFSharpReferencesAsync(inWorkspaceExtensions.fs), capping concurrency tomax 1 Environment.ProcessorCount.Files
vsintegration/src/FSharp.Editor/Common/CancellableTasks.fsvsintegration/src/FSharp.Editor/LanguageService/WorkspaceExtensions.fs