예제 #1
0
 private ImmutableArray <DiagnosticDescriptor> LoadSupportedDiagnostics()
 {
     return(Analyzers
            .SelectMany(f => f.SupportedDiagnostics)
            .Distinct(DiagnosticDescriptorComparer.Id)
            .OrderBy(f => f, DiagnosticDescriptorComparer.Id)
            .ToImmutableArray());
 }
예제 #2
0
        private ImmutableDictionary <string, DiagnosticDescriptor> LoadDiagnosticsById()
        {
            ImmutableDictionary <string, DiagnosticDescriptor> .Builder diagnosticsById = ImmutableDictionary.CreateBuilder <string, DiagnosticDescriptor>();

            diagnosticsById.AddRange(Analyzers
                                     .SelectMany(f => f.SupportedDiagnostics)
                                     .Distinct(DiagnosticDescriptorComparer.Id)
                                     .OrderBy(f => f, DiagnosticDescriptorComparer.Id)
                                     .Select(f => new KeyValuePair <string, DiagnosticDescriptor>(f.Id, f)));

            foreach (CodeFixProvider fixer in Fixers)
            {
                foreach (string diagnosticId in fixer.FixableDiagnosticIds)
                {
                    if (!diagnosticsById.ContainsKey(diagnosticId))
                    {
                        diagnosticsById[diagnosticId] = null;
                    }
                }
            }

            return(diagnosticsById.ToImmutable());
        }