Example #1
0
        public static SourceSpan GetSourceSpan(this SyntaxNode node, RazorSourceDocument source)
        {
            var location    = node.GetSourceLocation(source);
            var endLocation = source.Lines.GetLocation(node.EndPosition);
            var lineCount   = endLocation.LineIndex - location.LineIndex;

            return(new SourceSpan(location.FilePath, location.AbsoluteIndex, location.LineIndex, location.CharacterIndex, node.FullWidth, lineCount, endLocation.CharacterIndex));
        }
        public static SourceSpan GetSourceSpan(this SyntaxNode node, RazorSourceDocument source)
        {
            if (node == null)
            {
                throw new ArgumentNullException(nameof(node));
            }
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            var location = node.GetSourceLocation(source);

            return(new SourceSpan(location, node.FullWidth));
        }
Example #3
0
        public static SourceSpan GetSourceSpan(this SyntaxNode node, RazorSourceDocument source)
        {
            var location = node.GetSourceLocation(source);

            return(new SourceSpan(location, node.FullWidth));
        }