dotnet/roslyn
NormalizeWhitespace does not automatically insert a newline after documentation
开放
#50,626 创建于 2021年1月20日
Area-CompilersBughelp wanted
仓库指标
- 星标
- (20,414 个星标)
- PR 合并指标
- (平均合并 6天 17小时) (30 天内合并 256 个 PR)
描述
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.