本文整理汇总了C#中SyntaxTrivia.IsElastic方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxTrivia.IsElastic方法的具体用法?C# SyntaxTrivia.IsElastic怎么用?C# SyntaxTrivia.IsElastic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxTrivia
的用法示例。
在下文中一共展示了SyntaxTrivia.IsElastic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTouchedNoisyCharacter
private bool OnTouchedNoisyCharacter(SyntaxTrivia trivia)
{
if (trivia.IsElastic() ||
trivia.Kind() == SyntaxKind.WhitespaceTrivia ||
trivia.Kind() == SyntaxKind.EndOfLineTrivia)
{
return false;
}
_touchedNoisyCharacterOnCurrentLine = true;
_hasTrailingSpace = false;
return false;
}
示例2: OnElastic
private bool OnElastic(SyntaxTrivia trivia)
{
// if it contains elastic trivia, always format
return trivia.IsElastic();
}
示例3: AnalyzeLineBreak
private static void AnalyzeLineBreak(SyntaxTrivia trivia, ref AnalysisResult result)
{
// if there was any space before line break, then we have trailing spaces
if (result.Space > 0 || result.Tab > 0)
{
result.HasTrailingSpace = true;
}
// reset space and tab information
result.LineBreaks++;
result.HasTabAfterSpace = false;
result.Space = 0;
result.Tab = 0;
result.TreatAsElastic |= trivia.IsElastic();
}
示例4: AnalyzeWhitespacesInTrivia
private static void AnalyzeWhitespacesInTrivia(SyntaxTrivia trivia, ref AnalysisResult result)
{
// trivia already has text. getting text should be noop
Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia);
Debug.Assert(trivia.Width() == trivia.FullWidth());
int space = 0;
int tab = 0;
int unknownWhitespace = 0;
var text = trivia.ToString();
for (int i = 0; i < trivia.Width(); i++)
{
if (text[i] == ' ')
{
space++;
}
else if (text[i] == '\t')
{
if (result.Space > 0)
{
result.HasTabAfterSpace = true;
}
tab++;
}
else
{
unknownWhitespace++;
}
}
// set result
result.Space += space;
result.Tab += tab;
result.HasUnknownWhitespace |= unknownWhitespace > 0;
result.TreatAsElastic |= trivia.IsElastic();
}
示例5: IsDocCommentOrElastic
private static bool IsDocCommentOrElastic(SyntaxTrivia t)
{
return t.IsDocComment() || t.IsElastic();
}