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


C# SyntaxTrivia.IsDocComment方法代码示例

本文整理汇总了C#中SyntaxTrivia.IsDocComment方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxTrivia.IsDocComment方法的具体用法?C# SyntaxTrivia.IsDocComment怎么用?C# SyntaxTrivia.IsDocComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SyntaxTrivia的用法示例。


在下文中一共展示了SyntaxTrivia.IsDocComment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FormatStructuredTrivia

        private LineColumnDelta FormatStructuredTrivia(
            LineColumn lineColumn, SyntaxTrivia trivia, List<TextChange> changes, CancellationToken cancellationToken)
        {
            if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia)
            {
                // don't touch anything if it contains skipped tokens
                _succeeded = false;
                return GetLineColumnDelta(lineColumn, trivia);
            }

            // TODO : make document comment to be formatted by structured trivia formatter as well.
            if (!trivia.IsDocComment())
            {
                var result = CSharpStructuredTriviaFormatEngine.Format(
                    trivia, this.InitialLineColumn.Column, this.OptionSet, this.FormattingRules, cancellationToken);
                if (result.GetTextChanges(cancellationToken).Count == 0)
                {
                    return GetLineColumnDelta(lineColumn, trivia);
                }

                changes.AddRange(result.GetTextChanges(cancellationToken));

                var formattedTrivia = SyntaxFactory.Trivia((StructuredTriviaSyntax)result.GetFormattedRoot(cancellationToken));
                return GetLineColumnDelta(lineColumn, formattedTrivia);
            }

            var docComment = FormatDocumentComment(lineColumn, trivia);
            if (docComment != trivia)
            {
                changes.Add(new TextChange(trivia.FullSpan, docComment.ToFullString()));
            }

            return GetLineColumnDelta(lineColumn, docComment);
        }
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:34,代码来源:CSharpTriviaFormatter.cs

示例2: ClassifyTrivia

 private void ClassifyTrivia(SyntaxTrivia trivia)
 {
     if (trivia.IsRegularComment())
     {
         AddClassification(trivia, ClassificationTypeNames.Comment);
     }
     else if (trivia.Kind() == SyntaxKind.DisabledTextTrivia)
     {
         AddClassification(trivia, ClassificationTypeNames.ExcludedCode);
     }
     else if (trivia.Kind() == SyntaxKind.SkippedTokensTrivia)
     {
         ClassifySkippedTokens((SkippedTokensTriviaSyntax)trivia.GetStructure());
     }
     else if (trivia.IsDocComment())
     {
         ClassifyDocumentationComment((DocumentationCommentTriviaSyntax)trivia.GetStructure());
     }
     else if (trivia.Kind() == SyntaxKind.DocumentationCommentExteriorTrivia)
     {
         AddClassification(trivia, ClassificationTypeNames.XmlDocCommentDelimiter);
     }
     else if (SyntaxFacts.IsPreprocessorDirective(trivia.Kind()))
     {
         ClassifyPreprocessorDirective((DirectiveTriviaSyntax)trivia.GetStructure());
     }
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:27,代码来源:Worker.cs

示例3: IsDocCommentOrElastic

 private static bool IsDocCommentOrElastic(SyntaxTrivia t)
 {
     return t.IsDocComment() || t.IsElastic();
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:CompilationUnitSyntaxExtensions.cs


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