Skip to content

Commit

Permalink
Merge pull request #41119 from siegfriedpammer/mas-xmldoc-fixes
Browse files Browse the repository at this point in the history
Fix issues in MetadataAsSource XML documentation comment conversion
  • Loading branch information
sharwell authored Jan 31, 2020
2 parents 69d3fb7 + c18368d commit 4981a98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,16 @@ public override SyntaxNode Visit(SyntaxNode node)
{
if (trivia.Kind() == SyntaxKind.SingleLineDocumentationCommentTrivia)
{
newLeadingTrivia.Add(SyntaxFactory.Comment("//"));
newLeadingTrivia.Add(SyntaxFactory.ElasticCarriageReturnLineFeed);

var structuredTrivia = (DocumentationCommentTriviaSyntax)trivia.GetStructure();
newLeadingTrivia.AddRange(ConvertDocCommentToRegularComment(structuredTrivia));
var commentLines = ConvertDocCommentToRegularComment(structuredTrivia).ToSyntaxTriviaList();

if (commentLines.Count > 0)
{
newLeadingTrivia.Add(SyntaxFactory.Comment("//"));
newLeadingTrivia.Add(SyntaxFactory.ElasticCarriageReturnLineFeed);

newLeadingTrivia.AddRange(commentLines);
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static string ExtractXMLFragment(string input, string docCommentPrefix)
using var list = s_pool.GetPooledObject();
while (reader.ReadLine() is string str)
{
str = str.TrimStart();
if (str.StartsWith(docCommentPrefix, StringComparison.Ordinal))
{
str = str.Substring(docCommentPrefix.Length);
Expand Down

0 comments on commit 4981a98

Please sign in to comment.