示例#1
0
        // Analysis
        public static string GetMessage(Compilation compilation, DiagnosticAnalyzer[] analyzers, Diagnostic[] diagnostics)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Analysis result:")) {
                builder.AppendObject(compilation);
                builder.AppendObject(analyzers);
                builder.AppendObject(diagnostics);
            }
            return(builder.ToString());
        }
示例#2
0
        // Generation
        public static string GetMessage(ISourceGenerator generator, Compilation compilation, GeneratedSourceResult[] sources, Diagnostic[] diagnostics, Exception?exception)
        {
            var builder = new HierarchicalStringBuilder();

            using (builder.AppendTitle("Generation result:")) {
                builder.AppendLine("Generator: {0}", generator.GetType().Name);
                builder.AppendObject(compilation);
                builder.AppendObject(diagnostics);
                builder.AppendObject(exception);
                builder.AppendObject(sources);
            }
            return(builder.ToString());
        }
示例#3
0
        // Render/Text/Hierarchical
        public static string RenderToHierarchicalText(this ProjectArchNode project)
        {
            var builder = new HierarchicalStringBuilder();

            builder.AppendObject(project);
            return(builder.ToString());
        }
示例#4
0
 private static void AppendObject(this HierarchicalStringBuilder builder, NamespaceArchNode @namespace)
 {
     using var scope = builder.AppendSection("Namespace: {0}", @namespace.Name);
     foreach (var group in @namespace.Groups)
     {
         builder.AppendObject(group);
     }
 }
示例#5
0
 private static void AppendObject(this HierarchicalStringBuilder builder, ModuleArchNode module)
 {
     using var scope = builder.AppendSection("Module: {0}", module.Name);
     foreach (var @namespace in module.Namespaces)
     {
         builder.AppendObject(@namespace);
     }
 }
示例#6
0
 private static void AppendObject(this HierarchicalStringBuilder builder, ProjectArchNode project)
 {
     using (builder.AppendTitle("Project: {0}", project.Name)) {
         foreach (var module in project.Modules)
         {
             builder.AppendObject(module);
         }
     }
 }