Preserve diagnostics when rewriting Red nodes (dotnet/aspnetcore-tooling#319)

\n\nCommit migrated from 276532454e
This commit is contained in:
Ajay Bhargav Baaskaran 2019-03-11 10:31:37 -07:00 committed by GitHub
parent c7dcbd82d6
commit 6747e90b05
1 changed files with 3 additions and 0 deletions

View File

@ -1364,6 +1364,9 @@ namespace RazorSyntaxGenerator
Write(CamelCase(field.Name));
}
WriteLine(");");
WriteLine(" var diagnostics = GetDiagnostics();");
WriteLine(" if (diagnostics != null && diagnostics.Length > 0)");
WriteLine(" newNode = newNode.WithDiagnostics(diagnostics);");
WriteLine(" var annotations = GetAnnotations();");
WriteLine(" if (annotations != null && annotations.Length > 0)");
WriteLine(" return newNode.WithAnnotations(annotations);");