@@ -6,6 +6,7 @@ open System.Collections.Generic
66open FSharp.Compiler .TypeProviders
77open FSharp.Compiler .Text
88open FSharp.Core .CompilerServices
9+ open JetBrains.Core
910open JetBrains.Diagnostics
1011open JetBrains.Lifetimes
1112open JetBrains.ProjectModel
@@ -86,9 +87,10 @@ type ITypeProvidersClient =
8687 compilerToolsPath: string list *
8788 m: range -> ITypeProvider list
8889
90+ abstract member Scope: TypeProvidersHostingScope
8991 abstract member Context: TypeProvidersContext
9092 abstract member IsActive: bool
91- abstract member Execute: ( TypeProvidersConnection -> 'a ) -> 'a
93+ abstract member RuntimeVersion: string
9294 abstract member Terminate: unit -> unit
9395 abstract member Dump: unit -> string
9496
@@ -121,6 +123,7 @@ type internal TypeProvidersClientBase(lifetimeDef: LifetimeDefinition, connectio
121123 member this.Lifetime = lifetime
122124 member this.DisposeTypeProviders ( path : string ) = disposeTypeProviders path
123125 abstract member CreateTypeProviders: RdTypeProvider [] * TypeProvidersContext * ResolutionEnvironment -> IProxyTypeProvider list
126+ abstract member Scope: TypeProvidersHostingScope
124127
125128 interface ITypeProvidersClient with
126129 member x.GetOrCreate ( runTimeAssemblyFileName : string , designTimeAssemblyNameString : string ,
@@ -152,13 +155,27 @@ type internal TypeProvidersClientBase(lifetimeDef: LifetimeDefinition, connectio
152155
153156 typeProviderProxies
154157
158+ member this.Scope = this.Scope
155159 member this.Context = tpContext
156160 member this.IsActive = connection.IsActive
157- member this.Execute ( action ) = connection.Execute( fun _ -> action( connection))
158161 member this.Terminate () = lifetimeDef.Terminate()
159162
160163 member this.Dump () =
161- $" {typeProviders.Dump()}\n\n {tpContext.Dump()}"
164+ let this = this :> ITypeProvidersClient
165+ let scope = this.Scope
166+
167+ if not this.IsActive then $" {scope}: Out-of-process disabled" else
168+
169+ let inProcessDump =
170+ $" [{scope} - In-Process dump]:\n\n " + $" {typeProviders.Dump()}\n\n {tpContext.Dump()}"
171+
172+ let outOfProcessDump =
173+ $" [{scope} - Out-Process dump]:\n\n {connection.ProtocolModel.RdTestHost.Dump.Sync(Unit.Instance)}"
174+
175+ $" {inProcessDump}\n\n {outOfProcessDump}"
176+
177+ member this.RuntimeVersion =
178+ connection.ProtocolModel.RdTestHost.RuntimeVersion.Sync( Unit.Instance)
162179
163180
164181type internal SolutionTypeProvidersClient ( lifetimeDef : LifetimeDefinition ,
@@ -188,6 +205,8 @@ type internal SolutionTypeProvidersClient(lifetimeDef: LifetimeDefinition,
188205 use lock = lock.Push()
189206 projectsWithGenerativeProviders.Add( project.GetPersistentID()) |> ignore
190207
208+ override this.Scope = TypeProvidersHostingScope.Solution
209+
191210 override this.CreateTypeProviders ( tps , context , resolutionEnv ) =
192211 let psiModule =
193212 resolutionEnv.OutputFile
@@ -216,5 +235,7 @@ type internal ScriptTypeProvidersClient(lifetimeDef: LifetimeDefinition, connect
216235 scriptPsiModulesProvider.ModuleInvalidated.Advise( this.Lifetime, fun psiModule ->
217236 this.DisposeTypeProviders( psiModule.Path.FullPath))
218237
238+ override this.Scope = TypeProvidersHostingScope.Scripts
239+
219240 override this.CreateTypeProviders ( tps , context , _ ) =
220241 [ for tp in tps -> new ProxyTypeProvider( tp, context, null ) ]
0 commit comments