Skip to content

Commit

Permalink
Cancellable: set token in more places
Browse files Browse the repository at this point in the history
  • Loading branch information
auduchinok committed Jan 29, 2025
1 parent 2edab12 commit 900521f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Compiler/Service/BackgroundCompiler.fs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ type internal BackgroundCompiler
match tryGetBuilder options with
| Some getBuilder ->
async {
do! Cancellable.UseToken()
match! getBuilder with
| builderOpt, creationDiags when builderOpt.IsNone || not builderOpt.Value.IsReferencesInvalidated ->
return builderOpt, creationDiags
Expand Down
2 changes: 2 additions & 0 deletions src/Compiler/Service/ServiceAnalysis.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ open System
open System.Collections.Generic
open System.Runtime.CompilerServices
open Internal.Utilities.Library
open FSharp.Compiler
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Symbols
open FSharp.Compiler.Syntax.PrettyNaming
Expand Down Expand Up @@ -301,6 +302,7 @@ module UnusedOpens =
/// Async to allow cancellation.
let getUnusedOpens (checkFileResults: FSharpCheckFileResults, getSourceLineStr: int -> string) : Async<range list> =
async {
do! Cancellable.UseToken()
if checkFileResults.OpenDeclarations.Length = 0 then
return []
else
Expand Down

0 comments on commit 900521f

Please sign in to comment.