WithDocuments(this Project project, WipFileConversion <SyntaxNode>[] results) { var firstPassDocIds = results.Select(firstPassResult => { DocumentId docId = null; if (firstPassResult.Wip != null) { docId = DocumentId.CreateNewId(project.Id); var solution = project.Solution.AddDocument(docId, firstPassResult.Path, firstPassResult.Wip, filePath: firstPassResult.Path); project = solution.GetProject(project.Id); } return(WipFileConversion.Create(firstPassResult.Path, docId, firstPassResult.Errors)); }).ToList(); //ToList ensures that the project returned has all documents added. We only return DocumentIds so it's easy to look up the final version of the doc later return(project, firstPassDocIds); }
public static IEnumerable <WipFileConversion <Document> > GetDocuments(this Project project, List <WipFileConversion <DocumentId> > docIds) { return(docIds.Select(f => WipFileConversion.Create(f.Path, f.Wip != null ? project.GetDocument(f.Wip) : null, f.Errors))); }