@@ -142,6 +142,17 @@ type FSharpCompilerServiceChecker() =
142
142
if s.StartsWith( prefix) then Some ( s.Substring( prefix.Length))
143
143
else None
144
144
145
+ let rec allSymbolsInEntities ( entities : Collections.Generic.IList < FSharpEntity >) =
146
+ [ for e in entities do
147
+ yield ( e :> FSharpSymbol)
148
+ for x in e.MembersFunctionsAndValues do
149
+ yield ( x :> FSharpSymbol)
150
+ for x in e.UnionCases do
151
+ yield ( x :> FSharpSymbol)
152
+ for x in e.FSharpFields do
153
+ yield ( x :> FSharpSymbol)
154
+ yield ! allSymbolsInEntities e.NestedEntities ]
155
+
145
156
member __.GetUsesOfSymbol ( options : ( SourceFilePath * FSharpProjectOptions ) seq , symbol ) = async {
146
157
let! res =
147
158
options
@@ -188,6 +199,24 @@ type FSharpCompilerServiceChecker() =
188
199
return parseResult.GetNavigationItems() .Declarations
189
200
}
190
201
202
+ member __.GetDeclarationsInProjects ( options : seq < string * FSharpProjectOptions >) =
203
+ options
204
+ |> Seq.distinctBy( fun ( _ , v ) -> v.ProjectFileName)
205
+ |> Seq.map ( fun ( _ , opts ) -> async {
206
+ let! _ = checker.ParseAndCheckProject opts
207
+ return !
208
+ options
209
+ |> Seq.filter ( fun ( _ , projectOpts ) -> projectOpts = opts)
210
+ |> Seq.map fst
211
+ |> Seq.map ( fun projectFile -> async {
212
+ let! parseRes , _ = checker.GetBackgroundCheckResultsForFileInProject( projectFile, opts)
213
+ return ( parseRes.GetNavigationItems() .Declarations |> Array.map ( fun decl -> decl, projectFile))
214
+ })
215
+ |> Async.Parallel
216
+ })
217
+ |> Async.Parallel
218
+ |> Async.map ( Seq.collect ( Seq.collect id) >> Seq.toArray)
219
+
191
220
member __.TryGetProjectOptions ( file : SourceFilePath , verbose : bool ) : Result < _ > =
192
221
if not ( File.Exists file) then
193
222
Failure ( sprintf " File '%s ' does not exist" file)
0 commit comments