@@ -86,10 +86,7 @@ type Loader private (msbuildPath, msbuildNetSdkPath) =
8686 Error ( GetProjectOptionsErrors.GenericError( proj, " not found" ))
8787
8888 match loader notify cache project with
89- | Ok ( po, sources, props, additionalProjs) ->
90- // TODO sources and props are wrong, because not project specific. but of root proj
91- let loaded po = WorkspaceProjectState.Loaded ( po, sources, props)
92-
89+ | Ok ( po, props, additionalProjs) ->
9390 let rec visit ( p : ProjectOptions ) = seq {
9491 yield p
9592 for p2pRef in p.ReferencedProjects do
@@ -102,7 +99,8 @@ type Loader private (msbuildPath, msbuildNetSdkPath) =
10299 parsedProjects.AddOrUpdate( getKey proj, proj, fun _ _ -> proj) |> ignore
103100
104101 for proj in visit po do
105- notify ( loaded proj)
102+ WorkspaceProjectState.Loaded ( proj, props)
103+ |> notify
106104
107105 | Error e ->
108106 let failed = WorkspaceProjectState.Failed ( project, e)
@@ -163,3 +161,39 @@ type NetFWInfo private (msbuildPath) =
163161
164162 static member Create ( config : NetFWInfoConfig ) =
165163 NetFWInfo( config.MSBuildHost)
164+
165+ type ProjectViewerTree =
166+ { Name: string ;
167+ Items: ProjectViewerItem list }
168+ and [<RequireQualifiedAccess>] ProjectViewerItem =
169+ | Compile of string
170+
171+ type ProjectViewer () =
172+
173+ member __.Render ( proj : ProjectOptions ) =
174+
175+ let compileFiles =
176+ let sources = proj.SourceFiles
177+ match proj.ExtraProjectInfo.ProjectSdkType with
178+ | ProjectSdkType.Verbose _ ->
179+ //compatibility with old behaviour (projectcracker), so test output is exactly the same
180+ //the temp source files (like generated assemblyinfo.fs) are not added to sources
181+ let isTempFile ( name : string ) =
182+ let tempPath = Path.GetTempPath()
183+ let s = name.ToLower()
184+ s.StartsWith( tempPath.ToLower())
185+ sources
186+ |> List.filter ( fun p -> not ( isTempFile p))
187+ | ProjectSdkType.DotnetSdk _ ->
188+ //the generated assemblyinfo.fs are not shown as sources
189+ let isGeneratedAssemblyinfo ( name : string ) =
190+ let projName = proj.ProjectFileName |> Path.GetFileNameWithoutExtension
191+ //TODO check is in `obj` dir for the tfm
192+ //TODO better, get the name from fsproj
193+ //TODO cs too
194+ name.EndsWith( sprintf " %s .AssemblyInfo.fs" projName)
195+ sources
196+ |> List.filter ( fun p -> not ( isGeneratedAssemblyinfo p))
197+
198+ { ProjectViewerTree.Name = proj.ProjectFileName |> Path.GetFileNameWithoutExtension
199+ Items = compileFiles |> List.map ProjectViewerItem.Compile }
0 commit comments