dotnet/roslyn
NormalizeWhitespace does not automatically insert a newline after documentation
Ouverte
#50 626 ouverte le 20 janv. 2021
Area-CompilersBughelp wanted
Métriques du dépôt
- Stars
- (20 414 étoiles)
- Métriques de merge PR
- (Merge moyen 6j 17h) (256 PRs mergées en 30 j)
Description
Version Used: Mircrosoft.CodeAnalysis.Common : 4.0.30319
Steps to Reproduce:
- Emit a method using the following declaration:
MethodDeclaration(
PredefinedType(
Token(SyntaxKind.IntKeyword)),
Identifier("Method"))
.WithAttributeLists(
SingletonList(
AttributeList(
SingletonSeparatedList<AttributeSyntax>(
Attribute(
IdentifierName("Pure"))))
.WithOpenBracketToken(
Token(
TriviaList(
Trivia(
DocumentationCommentTrivia(
SyntaxKind.SingleLineDocumentationCommentTrivia,
SingletonList<XmlNodeSyntax>(
XmlText()
.WithTextTokens(
TokenList(
new []{
XmlTextLiteral(
TriviaList(
DocumentationCommentExterior("///")),
" Some cool documentation",
" Some cool documentation",
TriviaList())})))))),
SyntaxKind.OpenBracketToken,
TriviaList()))))
.WithModifiers(
TokenList(
Token(SyntaxKind.PublicKeyword)))
.WithBody(
Block(
SingletonList<StatementSyntax>(
ReturnStatement(
LiteralExpression(
SyntaxKind.NumericLiteralExpression,
Literal(1))))))
.NormalizeWhitespace());
Expected Behavior: Should automatically output a new line after the documentation
/// Some cool documentation
[Pure]
public int Method()
{
return 1;
}
Actual Behavior: Does not output a new line after the documentation
/// Some cool documentation[Pure]
public int Method()
{
return 1;
}
Manually adding a XmlTextNewLine token at the end of the documentation resolves the issue, not sure if this is the intended behavior.