コード例 #1
0
        /// <summary>
        /// Returns the count of whitespace at the front of the line provided.
        /// </summary>
        /// <param name="tokenNode">
        /// The tokenNode to start at.
        /// </param>
        /// <returns>
        /// The count of the leftmost whitespace.
        /// </returns>
        public static int GetOffsetToStartOfLine(ITokenNode tokenNode)
        {
            ITokenNode firstTokenOnLine = Utils.GetFirstNewLineTokenToLeft(tokenNode).GetNextToken();

            TreeOffset startPosition = firstTokenOnLine.ToTreeNode().GetTreeStartOffset();

            return tokenNode.ToTreeNode().GetTreeStartOffset() - startPosition;
        }