public int GetAnalysisMaximumProgress(VisualStudioWorkspace visualStudioWorkspace) { if (!visualStudioWorkspace.IsSolutionOpen()) { return(0); } // So far, we will report the progress after a single document is fully analyzed. // Therefore, here we just have to count the documents using exactly the same filters // as in the AnalyzeSingleSyntaxTreesAsync(). // BDW, the reuse of the filters in calculating the Analysis Maximum Progress and // in the analysis itself is the reason for the existinace of the two // ...Satisfies...Filter() methods. return(visualStudioWorkspace .CurrentSolution .Projects .Where(ProjectSatisfiesProjectFilter) .SelectMany(project => project.Documents) .Count(DocumentSatisfiesDocumentFilter)); }