本文整理汇总了C#中Microsoft.CodeAnalysis.SyntaxTree.GetTokenColumn方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxTree.GetTokenColumn方法的具体用法?C# SyntaxTree.GetTokenColumn怎么用?C# SyntaxTree.GetTokenColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.CodeAnalysis.SyntaxTree
的用法示例。
在下文中一共展示了SyntaxTree.GetTokenColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromAlignTokensOperations
public int? FromAlignTokensOperations(SyntaxTree tree, SyntaxToken token)
{
// let's check whether there is any missing token under us and whether
// there is an align token operation for that missing token.
var nextToken = token.GetNextToken(includeZeroWidth: true);
if (nextToken.RawKind != 0 &&
nextToken.Width() <= 0)
{
// looks like we have one. find whether there is a align token operation for this token
var alignmentBaseToken = GetAlignmentBaseTokenFor(nextToken);
if (alignmentBaseToken.RawKind != 0)
{
return tree.GetTokenColumn(alignmentBaseToken, _tabSize);
}
}
return null;
}
示例2: GetIndentationOfCurrentPosition
public int GetIndentationOfCurrentPosition(
SyntaxTree tree, SyntaxToken token, int position, int extraSpaces, CancellationToken cancellationToken)
{
// gather all indent operations
var list = GetParentIndentBlockOperations(token);
return GetIndentationOfCurrentPosition(
tree.GetRoot(cancellationToken),
token, list, position, extraSpaces,
t => tree.GetTokenColumn(t, _tabSize),
cancellationToken);
}