17 public void Execute(GeneratorExecutionContext context)
19 foreach (var additionalFile
in context.AdditionalFiles)
21 if (Path.GetFileName(additionalFile.Path) !=
"Diagnostics.csv" ||
22 additionalFile.GetText() is not { } text)
25 Console.WriteLine(additionalFile.Path);
27 var builder =
new StringBuilder();
33 using Microsoft.CodeAnalysis;
35 namespace Lilac.Generator
37 internal static class Diagnostics
41 foreach (var line
in text.Lines.Skip(1))
43 var props = line.ToString().Split(
',');
45 var severity = props[2]
48 severity[0] =
char.ToUpperInvariant(severity[0]);
52 public static DiagnosticDescriptor {{props[3].Replace(' ', '_')}} { get; } = new(
57 DiagnosticSeverity.{{new string(severity)}},
68 context.AddSource(
"Diagnostics.g.cs", SourceText.From(builder.ToString(), Encoding.UTF8));