dotnet/roslyn
NormalizeWhitespace does not automatically insert a newline after documentation
Aperta
#50.626 aperta il 20 gen 2021
Area-CompilersBughelp wanted
Metriche repository
- Star
- (20.414 stelle)
- Metriche merge PR
- (Merge medio 6g 17h) (256 PR mergiate in 30 g)
Descrizione
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.