private async Task <Solution> GetSolutionFixesAsync(FixAllContext fixAllContext, ImmutableArray <Document> documents) { var documentDiagnosticsToFix = await FixAllContextHelper.GetDocumentDiagnosticsToFixAsync(fixAllContext).ConfigureAwait(false); var solution = fixAllContext.Solution; var newDocuments = new List <Task <SyntaxNode> >(documents.Length); foreach (var document in documents) { ImmutableArray <Diagnostic> diagnostics; if (!documentDiagnosticsToFix.TryGetValue(document, out diagnostics)) { newDocuments.Add(document.GetSyntaxRootAsync(fixAllContext.CancellationToken)); continue; } newDocuments.Add(FixAllInDocumentAsync(fixAllContext, document, diagnostics)); } for (var i = 0; i < documents.Length; i++) { var newDocumentRoot = await newDocuments[i].ConfigureAwait(false); if (newDocumentRoot == null) { continue; } solution = solution.WithDocumentSyntaxRoot(documents[i].Id, newDocumentRoot); } return(solution); }
private async Task <Document> GetDocumentFixesAsync(FixAllContext fixAllContext) { var documentDiagnosticsToFix = await FixAllContextHelper.GetDocumentDiagnosticsToFixAsync(fixAllContext).ConfigureAwait(false); ImmutableArray <Diagnostic> diagnostics; if (!documentDiagnosticsToFix.TryGetValue(fixAllContext.Document, out diagnostics)) { return(fixAllContext.Document); } var newRoot = await FixAllInDocumentAsync(fixAllContext, fixAllContext.Document, diagnostics).ConfigureAwait(false); if (newRoot == null) { return(fixAllContext.Document); } return(fixAllContext.Document.WithSyntaxRoot(newRoot)); }
public virtual Task <ImmutableDictionary <Document, ImmutableArray <Diagnostic> > > GetDocumentDiagnosticsToFixAsync(FixAllContext fixAllContext) { return(FixAllContextHelper.GetDocumentDiagnosticsToFixAsync(fixAllContext)); }