@@ -1918,22 +1918,6 @@ type FSharpCheckFileResults(errors: FSharpErrorInfo[], scopeOptX: TypeCheckInfo
19181918 reactor.EnqueueOp( " Dispose" , fun () -> decrementer.Dispose())
19191919| _ -> ()
19201920
1921- // Run an operation that needs to be run in the reactor thread
1922- let reactorOp desc dflt f =
1923- async {
1924- match detailswith
1925- | None->
1926- return dflt
1927- | Some(_ , Some builder, _) when not builder.IsAlive->
1928- System.Diagnostics.Debug.Assert( false , " unexpected dead builder" )
1929- return dflt
1930- | Some( scope, builderOpt, reactor) ->
1931- // Ensure the builder doesn't get released while running operations asynchronously.
1932- use _unwind= match builderOptwith Some builder-> builder.IncrementUsageCount() | None-> { new System.IDisposablewith member __.Dispose () = () }
1933- let! res = reactor.EnqueueAndAwaitOpAsync( desc, fun _ct -> f scope)
1934- return res
1935- }
1936-
19371921// Run an operation that can be called from any thread
19381922let threadSafeOp dflt f =
19391923match detailswith
@@ -1942,8 +1926,8 @@ type FSharpCheckFileResults(errors: FSharpErrorInfo[], scopeOptX: TypeCheckInfo
19421926| Some(_ , Some builder, _) when not builder.IsAlive->
19431927 System.Diagnostics.Debug.Assert( false , " unexpected dead builder" )
19441928 dflt()
1945- | Some( scope, builderOpt , ops ) ->
1946- f( scope , builderOpt , ops )
1929+ | Some( scope, _, _ )->
1930+ f scope
19471931
19481932// At the moment we only dispose on finalize - we never explicitly dispose these objects. Explicitly disposing is not
19491933// really worth much since the underlying project builds are likely to still be in the incrementalBuilder cache.
@@ -1954,122 +1938,97 @@ type FSharpCheckFileResults(errors: FSharpErrorInfo[], scopeOptX: TypeCheckInfo
19541938member info.HasFullTypeCheckInfo = details.IsSome
19551939
19561940/// Intellisense autocompletions
1957- //member info.GetDeclarationListInfo(parseResultsOpt, line, colAtEndOfNamesAndResidue, lineStr, qualifyingNames, partialName, ?hasTextChangedSinceLastTypecheck) =
1958- // let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck (fun _ -> false)
1959- // reactorOp "GetDeclarations" FSharpDeclarationListInfo.Empty (fun scope ->
1960- // let sw = System.Diagnostics.Stopwatch.StartNew()
1961- // let r = scope.GetDeclarations(parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck)
1962- // System.IO.File.WriteAllText(@"e:\___3.txt", sprintf "scope.GetDeclarations: %O" sw.Elapsed)
1963- // r
1964- // )
1965-
19661941member info.GetDeclarationListInfo ( parseResultsOpt , line , colAtEndOfNamesAndResidue , lineStr , qualifyingNames , partialName , ? hasTextChangedSinceLastTypecheck ) =
1967- async {
1968- let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck( fun _ -> false )
1969- return
1970- threadSafeOp
1971- ( fun () -> failwith" not available" )
1972- ( fun ( scope , _builder , _reactor ) ->
1973- scope.GetDeclarations( parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck))
1974- }
1942+ let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck( fun _ -> false )
1943+ threadSafeOp
1944+ ( fun () -> failwith" not available" )
1945+ ( fun scope ->
1946+ scope.GetDeclarations( parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck))
19751947
19761948member info.GetDeclarationListSymbols ( parseResultsOpt , line , colAtEndOfNamesAndResidue , lineStr , qualifyingNames , partialName , ? hasTextChangedSinceLastTypecheck ) =
19771949let hasTextChangedSinceLastTypecheck = defaultArg hasTextChangedSinceLastTypecheck( fun _ -> false )
1978- reactorOp" GetDeclarationListSymbols" List.empty( fun scope -> scope.GetDeclarationListSymbols( parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck))
1950+ threadSafeOp
1951+ ( fun () -> [])
1952+ ( fun scope -> scope.GetDeclarationListSymbols( parseResultsOpt, line, lineStr, colAtEndOfNamesAndResidue, qualifyingNames, partialName, hasTextChangedSinceLastTypecheck))
19791953
19801954/// Resolve the names at the given location to give a data tip
19811955member info.GetStructuredToolTipTextAlternate ( line , colAtEndOfNames , lineStr , names , tokenTag ) =
19821956let dflt = FSharpToolTipText[]
19831957match tokenTagToTokenId tokenTagwith
19841958| TOKEN_ IDENT->
1985- reactorOp " GetToolTipText " dflt( fun scope -> scope.GetStructuredToolTipText line lineStr colAtEndOfNames names)
1959+ threadSafeOp ( fun () -> dflt) ( fun scope -> scope.GetStructuredToolTipText line lineStr colAtEndOfNames names)
19861960| TOKEN_ STRING| TOKEN_ STRING_ TEXT->
1987- reactorOp " GetReferenceResolutionToolTipText " dflt( fun scope -> scope.GetReferenceResolutionStructuredToolTipText( line, colAtEndOfNames) )
1961+ threadSafeOp ( fun () -> dflt) ( fun scope -> scope.GetReferenceResolutionStructuredToolTipText( line, colAtEndOfNames))
19881962| _ ->
1989- async.Return dflt
1963+ dflt
19901964
19911965member info.GetToolTipTextAlternate ( line , colAtEndOfNames , lineStr , names , tokenTag ) =
19921966 info.GetStructuredToolTipTextAlternate( line, colAtEndOfNames, lineStr, names, tokenTag)
1993- |> Tooltips.Map Tooltips. ToFSharpToolTipText
1967+ |> Tooltips.ToFSharpToolTipText
19941968
19951969member info.GetF1KeywordAlternate ( line , colAtEndOfNames , lineStr , names ) =
1996- reactorOp" GetF1Keyword" None( fun scope ->
1997- scope.GetF1Keyword( line, lineStr, colAtEndOfNames, names))
1970+ threadSafeOp( fun () -> None) ( fun scope -> scope.GetF1Keyword( line, lineStr, colAtEndOfNames, names))
19981971
19991972// Resolve the names at the given location to a set of methods
20001973member info.GetMethodsAlternate ( line , colAtEndOfNames , lineStr , names ) =
2001- let dflt = FSharpMethodGroup( " " ,[| |])
2002- reactorOp" GetMethods" dflt( fun scope ->
1974+ threadSafeOp( fun () -> FSharpMethodGroup( " " , [||])) ( fun scope ->
20031975 scope.GetMethods( line, lineStr, colAtEndOfNames, names))
20041976
20051977member info.GetDeclarationLocationAlternate ( line , colAtEndOfNames , lineStr , names , ? preferFlag ) =
20061978let dflt = FSharpFindDeclResult.DeclNotFound FSharpFindDeclFailureReason.Unknown
2007- reactorOp " GetDeclarationLocation " dflt( fun scope ->
1979+ threadSafeOp ( fun () -> dflt) ( fun scope ->
20081980 scope.GetDeclarationLocation( line, lineStr, colAtEndOfNames, names, preferFlag))
20091981
20101982member info.GetSymbolUseAtLocation ( line , colAtEndOfNames , lineStr , names ) =
2011- reactorOp " GetSymbolUseAtLocation " None( fun scope ->
1983+ threadSafeOp ( fun () -> None) ( fun scope ->
20121984 scope.GetSymbolUseAtLocation( line, lineStr, colAtEndOfNames, names)
20131985|> Option.map( fun ( sym , denv , m ) -> FSharpSymbolUse( scope.TcGlobals, denv, sym, ItemOccurence.Use, m)))
20141986
20151987member info.GetMethodsAsSymbols ( line , colAtEndOfNames , lineStr , names ) =
2016- reactorOp " GetMethodsAsSymbols " None( fun scope ->
1988+ threadSafeOp ( fun () -> None) ( fun scope ->
20171989 scope.GetMethodsAsSymbols( line, lineStr, colAtEndOfNames, names)
20181990|> Option.map( fun ( symbols , denv , m ) ->
20191991 symbols|> List.map( fun sym -> FSharpSymbolUse( scope.TcGlobals, denv, sym, ItemOccurence.Use, m))))
20201992
20211993member info.GetSymbolAtLocationAlternate ( line , colAtEndOfNames , lineStr , names ) =
2022- reactorOp " GetSymbolUseAtLocation " None( fun scope ->
1994+ threadSafeOp ( fun () -> None) ( fun scope ->
20231995 scope.GetSymbolUseAtLocation( line, lineStr, colAtEndOfNames, names)
20241996|> Option.map( fun ( sym , _ , _ ) -> sym))
20251997
2026-
20271998member info.GetFormatSpecifierLocations () =
2028- threadSafeOp
2029- ( fun () -> [| |])
2030- ( fun ( scope , _builder , _reactor ) ->
2031- // This operation is not asynchronous - GetFormatSpecifierLocations can be run on the calling thread
2032- scope.GetFormatSpecifierLocations())
1999+ threadSafeOp( fun () -> [||]) ( fun scope -> scope.GetFormatSpecifierLocations())
20332000
20342001member info.GetExtraColorizationsAlternate () =
2035- threadSafeOp
2036- ( fun () -> [| |])
2037- ( fun ( scope , _builder , _reactor ) ->
2038- // This operation is not asynchronous - GetExtraColorizations can be run on the calling thread
2039- scope.GetExtraColorizations())
2002+ threadSafeOp( fun () -> [||]) ( fun scope -> scope.GetExtraColorizations())
20402003
20412004member info.PartialAssemblySignature =
20422005 threadSafeOp
20432006( fun () -> failwith" not available" )
2044- ( fun ( scope , _builder , _reactor ) ->
2045- // This operation is not asynchronous - PartialAssemblySignature can be run on the calling thread
2046- scope.PartialAssemblySignature())
2007+ ( fun scope -> scope.PartialAssemblySignature())
20472008
20482009member info.ProjectContext =
20492010 threadSafeOp
20502011( fun () -> failwith" not available" )
2051- ( fun ( scope , _builder , _reactor ) ->
2052- // This operation is not asynchronous - GetReferencedAssemblies can be run on the calling thread
2053- FSharpProjectContext( scope.ThisCcu, scope.GetReferencedAssemblies(), scope.AccessRights))
2012+ ( fun scope -> FSharpProjectContext( scope.ThisCcu, scope.GetReferencedAssemblies(), scope.AccessRights))
20542013
20552014member info.GetAllUsesOfAllSymbolsInFile () =
2056- reactorOp " GetAllUsesOfAllSymbolsInFile " [| |] ( fun scope ->
2015+ threadSafeOp ( fun () -> [||]) ( fun scope ->
20572016[| for ( item, itemOcc, denv, m) in scope.ScopeSymbolUses.GetAllUsesOfSymbols() do
20582017if itemOcc<> ItemOccurence.RelatedTextthen
20592018let symbol = FSharpSymbol.Create( scope.TcGlobals, scope.ThisCcu, scope.TcImports, item)
20602019yield FSharpSymbolUse( scope.TcGlobals, denv, symbol, itemOcc, m) |])
20612020
20622021member info.GetUsesOfSymbolInFile ( symbol : FSharpSymbol ) =
2063- reactorOp " GetUsesOfSymbolInFile " [| |] ( fun scope ->
2022+ threadSafeOp ( fun () -> [||]) ( fun scope ->
20642023[| for ( itemOcc, denv, m) in scope.ScopeSymbolUses.GetUsesOfSymbol( symbol.Item) |> Seq.distinctBy( fun ( itemOcc , _denv , m ) -> itemOcc, m) do
20652024if itemOcc<> ItemOccurence.RelatedTextthen
20662025yield FSharpSymbolUse( scope.TcGlobals, denv, symbol, itemOcc, m) |])
20672026
2068- member info.GetVisibleNamespacesAndModulesAtPoint ( pos : pos ) : Async < ModuleOrNamespaceRef []> =
2069- reactorOp " GetDeclarations " [| |] ( fun scope -> scope.GetVisibleNamespacesAndModulesAtPosition( pos) |> List.toArray)
2027+ member info.GetVisibleNamespacesAndModulesAtPoint ( pos : pos ) =
2028+ threadSafeOp ( fun () -> [||]) ( fun scope -> scope.GetVisibleNamespacesAndModulesAtPosition( pos) |> List.toArray)
20702029
2071- member info.IsRelativeNameResolvable ( pos : pos , plid : string list , item : Item ) : Async < bool > =
2072- reactorOp " IsRelativeNameResolvable " true ( fun scope -> scope.IsRelativeNameResolvable( pos, plid, item))
2030+ member info.IsRelativeNameResolvable ( pos : pos , plid : string list , item : Item ) =
2031+ threadSafeOp ( fun () -> true ) ( fun scope -> scope.IsRelativeNameResolvable( pos, plid, item))
20732032
20742033//----------------------------------------------------------------------------
20752034// BackgroundCompiler