当前位置: 首页>>代码示例>>C#>>正文


C# SyntaxNodeAnalysisContext.IsDocumentationModeOn方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:jimmymain,项目名称:Documentation.Analyzers,代码行数:23,代码来源:DocumentationMemberAnalyser.cs

示例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);
                }
            }
        }
开发者ID:jimmymain,项目名称:Documentation.Analyzers,代码行数:26,代码来源:DocumentationPropertyAnalyser.cs

示例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);
            }
        }
开发者ID:jimmymain,项目名称:Documentation.Analyzers,代码行数:31,代码来源:DocumentationMethodAnalyser.cs

示例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);
        }
开发者ID:jimmymain,项目名称:Documentation.Analyzers,代码行数:13,代码来源:DocumentationClassAnalyser.cs


注:本文中的SyntaxNodeAnalysisContext.IsDocumentationModeOn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。