本文整理汇总了C#中SyntaxNodeAnalysisContext.IsDocumentationModeOn方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxNodeAnalysisContext.IsDocumentationModeOn方法的具体用法?C# SyntaxNodeAnalysisContext.IsDocumentationModeOn怎么用?C# SyntaxNodeAnalysisContext.IsDocumentationModeOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxNodeAnalysisContext
的用法示例。
在下文中一共展示了SyntaxNodeAnalysisContext.IsDocumentationModeOn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleMemberDeclaration
/// <summary>
/// handle the case of a constructor, and associated parameters.
/// </summary>
/// <param name="context">the constructor declaration context.</param>
private void HandleMemberDeclaration(SyntaxNodeAnalysisContext context)
{
if (!context.IsDocumentationModeOn())
return;
var declaration = (FieldDeclarationSyntax)context.Node;
if (declaration.SyntaxTree.IsGeneratedCode(context.CancellationToken))
return;
var variable = declaration
.DescendantNodesAndSelf()
.OfType<VariableDeclaratorSyntax>()
.FirstOrDefault();
if (variable != null && !declaration.HasDocumentation())
{
var diagnostic = Diagnostic.Create(this.Descriptor, variable.Identifier.GetLocation());
context.ReportDiagnostic(diagnostic);
}
}
示例2: HandlePropertyDeclaration
/// <summary>
/// Handle the property declaration, adding a diagnostic for properties
/// that are not documented.
/// </summary>
/// <param name="context">the analysis context.</param>
private void HandlePropertyDeclaration(SyntaxNodeAnalysisContext context)
{
if (!context.IsDocumentationModeOn())
return;
var declaration = (PropertyDeclarationSyntax)context.Node;
{
if (declaration.SyntaxTree.IsGeneratedCode(context.CancellationToken))
return;
var hasDocumentation = declaration.HasDocumentation();
if (!hasDocumentation || !this.ValidDocumentation(declaration))
{
var diagnosis = !hasDocumentation
? "no documentation"
: $"does not start with '{this._commentTextFactory.BuildSummaryTextPrefixForProperty(declaration)}'";
var diagnostic = Diagnostic.Create(this.Descriptor, declaration.Identifier.GetLocation(), diagnosis);
context.ReportDiagnostic(diagnostic);
}
}
}
示例3: HandleMethodDeclaration
/// <summary>
/// Handle the property declaration, adding a diagnostic for properties
/// that are not documented.
/// </summary>
/// <param name="context">the analysis context.</param>
private void HandleMethodDeclaration(SyntaxNodeAnalysisContext context)
{
if (!context.IsDocumentationModeOn())
return;
var declaration = (MethodDeclarationSyntax)context.Node;
if (declaration.SyntaxTree.IsGeneratedCode(context.CancellationToken))
return;
var hasDocumentation = declaration.HasDocumentation();
var hasSummary = declaration.HasSummary();
if (!hasDocumentation
|| !hasSummary
|| !this.ValidateParameters(declaration)
|| !this.ValidateTypeParameters(declaration)
|| !this.ValidateReturnValue(declaration))
{
var description = hasDocumentation
? hasSummary
? this.GetUndocumentedDescription(declaration)
: "no summary"
: "no documentation";
var diagnostic = Diagnostic.Create(this.Descriptor, declaration.Identifier.GetLocation(), description);
context.ReportDiagnostic(diagnostic);
}
}
示例4: HandleClassOrInterfaceDeclaration
/// <summary>
/// Handle the property declaration, adding a diagnostic for properties
/// that are not documented.
/// </summary>
/// <param name="context">the analysis context.</param>
private void HandleClassOrInterfaceDeclaration(SyntaxNodeAnalysisContext context)
{
if (!context.IsDocumentationModeOn())
return;
this.AnalyseClassDeclaration(context);
this.AnalyseInterfaceDeclaration(context);
}