本文整理汇总了C#中DiagnosticAnalyzer.SupportsSyntaxDiagnosticAnalysisAsync方法的典型用法代码示例。如果您正苦于以下问题:C# DiagnosticAnalyzer.SupportsSyntaxDiagnosticAnalysisAsync方法的具体用法?C# DiagnosticAnalyzer.SupportsSyntaxDiagnosticAnalysisAsync怎么用?C# DiagnosticAnalyzer.SupportsSyntaxDiagnosticAnalysisAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiagnosticAnalyzer
的用法示例。
在下文中一共展示了DiagnosticAnalyzer.SupportsSyntaxDiagnosticAnalysisAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldRunAnalyzerForStateTypeAsync
private static async Task<bool> ShouldRunAnalyzerForStateTypeAsync(DiagnosticAnalyzerDriver driver, DiagnosticAnalyzer analyzer, StateType stateTypeId,
ImmutableHashSet<string> diagnosticIds = null, Func<DiagnosticAnalyzer, ImmutableArray<DiagnosticDescriptor>> getDescriptors = null)
{
Debug.Assert(!driver.IsAnalyzerSuppressed(analyzer));
if (diagnosticIds != null && getDescriptors(analyzer).All(d => !diagnosticIds.Contains(d.Id)))
{
return false;
}
switch (stateTypeId)
{
case StateType.Syntax:
return await analyzer.SupportsSyntaxDiagnosticAnalysisAsync(driver).ConfigureAwait(false);
case StateType.Document:
return await analyzer.SupportsSemanticDiagnosticAnalysisAsync(driver).ConfigureAwait(false);
case StateType.Project:
return await analyzer.SupportsProjectDiagnosticAnalysisAsync(driver).ConfigureAwait(false);
default:
throw ExceptionUtilities.Unreachable;
}
}