private AnalyzersAndFixers GetAnalyzersAndFixers(Project project) { var analyzerAssemblies = project.AnalyzerReferences .Select(reference => TryLoadAssemblyFrom(reference.FullPath, new AnalyzerLoadContext())) .OfType <Assembly>() .ToImmutableArray(); return(AnalyzerFinderHelpers.LoadAnalyzersAndFixers(analyzerAssemblies)); }
public (ImmutableArray <DiagnosticAnalyzer> Analyzers, ImmutableArray <CodeFixProvider> Fixers) GetAnalyzersAndFixers( Solution solution, FormatOptions formatOptions, ILogger logger) { if (!formatOptions.FixAnalyzers) { return(ImmutableArray <DiagnosticAnalyzer> .Empty, ImmutableArray <CodeFixProvider> .Empty); } var assemblies = solution.Projects .SelectMany(project => project.AnalyzerReferences.Select(reference => reference.FullPath)) .Distinct() .Select(path => Assembly.LoadFrom(path)); return(AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies)); }
public ImmutableDictionary <ProjectId, AnalyzersAndFixers> GetAnalyzersAndFixers( Solution solution, FormatOptions formatOptions, ILogger logger) { var assemblies = new[] { _featuresPath, _featuresCSharpPath, _featuresVisualBasicPath }.Select(path => Assembly.LoadFrom(path)); var analyzersAndFixers = AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies); return(solution.Projects .ToImmutableDictionary(project => project.Id, project => analyzersAndFixers)); }
public (ImmutableArray <DiagnosticAnalyzer> Analyzers, ImmutableArray <CodeFixProvider> Fixers) GetAnalyzersAndFixers( Solution solution, FormatOptions options, ILogger logger) { if (!options.FixCodeStyle) { return(ImmutableArray <DiagnosticAnalyzer> .Empty, ImmutableArray <CodeFixProvider> .Empty); } var assemblies = new[] { _featuresPath, _featuresCSharpPath, _featuresVisualBasicPath }.Select(path => Assembly.LoadFrom(path)); return(AnalyzerFinderHelpers.LoadAnalyzersAndFixers(assemblies)); }