public static async Task <Document> RefactorAsync( Document document, AccessorListSyntax accessorList, CancellationToken cancellationToken) { if (accessorList.Accessors.All(f => f.BodyOrExpressionBody() == null)) { SyntaxNode parent = accessorList.Parent; switch (parent.Kind()) { case SyntaxKind.PropertyDeclaration: { var propertyDeclaration = (PropertyDeclarationSyntax)parent; TextSpan span = TextSpan.FromBounds( propertyDeclaration.Identifier.Span.End, accessorList.CloseBraceToken.Span.Start); PropertyDeclarationSyntax newNode = Remover.RemoveWhitespaceOrEndOfLine(propertyDeclaration, span); newNode = newNode.WithFormatterAnnotation(); return(await document.ReplaceNodeAsync(propertyDeclaration, newNode, cancellationToken).ConfigureAwait(false)); } case SyntaxKind.IndexerDeclaration: { var indexerDeclaration = (IndexerDeclarationSyntax)parent; TextSpan span = TextSpan.FromBounds( indexerDeclaration.ParameterList.CloseBracketToken.Span.End, accessorList.CloseBraceToken.Span.Start); IndexerDeclarationSyntax newNode = Remover.RemoveWhitespaceOrEndOfLine(indexerDeclaration, span); newNode = newNode.WithFormatterAnnotation(); return(await document.ReplaceNodeAsync(indexerDeclaration, newNode, cancellationToken).ConfigureAwait(false)); } default: { Debug.Assert(false, parent.Kind().ToString()); return(document); } } } else { AccessorListSyntax newAccessorList = GetNewAccessorList(accessorList); newAccessorList = AddNewLineAfterFirstAccessorIfNecessary(accessorList, newAccessorList, cancellationToken); newAccessorList = newAccessorList.WithFormatterAnnotation(); return(await document.ReplaceNodeAsync(accessorList, newAccessorList, cancellationToken).ConfigureAwait(false)); } }