public override async Task <Compilation> TransformCompilationAsync(Compilation oldCompilation, CancellationToken cancellationToken) { var syntaxTrees = new List <SyntaxTree>(capacity: _state.DocumentIds.Count); foreach (var documentState in _state.OrderedDocumentStates) { cancellationToken.ThrowIfCancellationRequested(); syntaxTrees.Add(await documentState.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false)); } return(oldCompilation.RemoveAllSyntaxTrees().AddSyntaxTrees(syntaxTrees)); }