本文整理汇总了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);
}
示例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());
}
}
示例3: IsDocCommentOrElastic
private static bool IsDocCommentOrElastic(SyntaxTrivia t)
{
return t.IsDocComment() || t.IsElastic();
}