private Task<Document> AddStaticKeyword(Document document, SyntaxNode root, ClassDeclarationSyntax classDeclaration) { var staticKeyword = SyntaxFactory.Token(SyntaxKind.StaticKeyword).WithAdditionalAnnotations(Formatter.Annotation); var newDeclaration = classDeclaration.AddModifiers(staticKeyword); var newRoot = root.ReplaceNode(classDeclaration, newDeclaration); return Task.FromResult(document.WithSyntaxRoot(newRoot)); }
private async Task<Document> AddSealedAsync(Document document, ClassDeclarationSyntax classDeclaration, CancellationToken cancellationToken) { var sealedKeyword = SyntaxFactory.Token(SyntaxKind.SealedKeyword).WithAdditionalAnnotations(Formatter.Annotation); var newClass = classDeclaration.AddModifiers(sealedKeyword); var root = await document.GetSyntaxRootAsync(cancellationToken); var newRoot = root.ReplaceNode(classDeclaration, newClass); var newDocument = document.WithSyntaxRoot(newRoot); return newDocument; }