public static async Task <Document> RefactorAsync( Document document, DocumentationCommentTriviaSyntax documentationComment, CancellationToken cancellationToken) { SourceText sourceText = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); int lineIndex = documentationComment.GetSpanStartLine(cancellationToken); XmlElementSyntax summaryElement = FormatSummaryRefactoring.GetSummaryElement(documentationComment); string newText = Environment.NewLine + new string(' ', documentationComment.FullSpan.Start - sourceText.Lines[lineIndex].Start) + "/// "; SourceText newSourceText = sourceText.WithChanges( new TextChange(new TextSpan(summaryElement.StartTag.Span.End, 0), newText), new TextChange(new TextSpan(summaryElement.EndTag.Span.Start, 0), newText)); return(document.WithText(newSourceText)); }