Added test for razor comment between code block and markup (dotnet/aspnetcore-tooling#14)

\n\nCommit migrated from 131003d0c3
This commit is contained in:
Ajay Bhargav Baaskaran 2018-12-05 11:48:33 -08:00 committed by GitHub
parent ad0f2a5af4
commit 0c71f4f520
1 changed files with 15 additions and 0 deletions

View File

@ -798,6 +798,21 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
private void ParseRazorCommentWithLeadingAndTrailingWhitespace(in SyntaxListBuilder<RazorSyntaxNode> builder)
{
if (Context.NullGenerateWhitespaceAndNewLine)
{
// Usually this is set to true when a Code block ends and there is whitespace left after it.
// We don't want to write it to output.
Context.NullGenerateWhitespaceAndNewLine = false;
SpanContext.ChunkGenerator = SpanChunkGenerator.Null;
AcceptWhile(IsSpacingToken(includeNewLines: false));
if (At(SyntaxKind.NewLine))
{
AcceptAndMoveNext();
}
builder.Add(OutputAsMarkupEphemeralLiteral());
}
var shouldRenderWhitespace = true;
var lastWhitespace = AcceptWhitespaceInLines();
var startOfLine = Context.StartOfLine;