private static async Task <Document> AddPartialModifier(Document document, TypeDeclarationSyntax typeDecl, CancellationToken cancellationToken) { var newTypeDecl = typeDecl.AddPartialModifier(); var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false) as CompilationUnitSyntax; var newRoolt = root.ReplaceNode(typeDecl, newTypeDecl) .WithAdditionalAnnotations(Formatter.Annotation); document = document.WithSyntaxRoot(newRoolt); return(document); }