コード例 #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);
         }
     }
 }