public static bool MustRunInProcess(this DiagnosticAnalyzer analyzer) { if (analyzer.IsWorkspaceDiagnosticAnalyzer()) { return(true); } var builtInAnalyzer = analyzer as IBuiltInAnalyzer; if (builtInAnalyzer == null) { return(false); } return(builtInAnalyzer.RunInProcess); }
public static bool ShouldRunForFullProject(this DiagnosticAnalyzerService service, DiagnosticAnalyzer analyzer, Project project) { var builtInAnalyzer = analyzer as IBuiltInAnalyzer; if (builtInAnalyzer != null) { return !builtInAnalyzer.OpenFileOnly(project.Solution.Workspace); } if (analyzer.IsWorkspaceDiagnosticAnalyzer()) { return true; } // most of analyzers, number of descriptor is quite small, so this should be cheap. return service.GetDiagnosticDescriptors(analyzer).Any(d => d.GetEffectiveSeverity(project.CompilationOptions) != ReportDiagnostic.Hidden); }
public static bool ShouldRunForFullProject(this DiagnosticAnalyzerService service, DiagnosticAnalyzer analyzer, Project project) { var builtInAnalyzer = analyzer as IBuiltInAnalyzer; if (builtInAnalyzer != null) { return(!builtInAnalyzer.OpenFileOnly(project.Solution.Workspace)); } if (analyzer.IsWorkspaceDiagnosticAnalyzer()) { return(true); } // most of analyzers, number of descriptor is quite small, so this should be cheap. return(service.GetDiagnosticDescriptors(analyzer).Any(d => d.GetEffectiveSeverity(project.CompilationOptions) != ReportDiagnostic.Hidden)); }
public static bool IsBuiltInAnalyzer(this DiagnosticAnalyzer analyzer) => analyzer is IBuiltInAnalyzer || analyzer.IsWorkspaceDiagnosticAnalyzer() || analyzer.IsCompilerAnalyzer();