Exemplo n.º 1
0
        private void OutputSourceWithLocation(string source, SourceRange range)
        {
            var context = range.GetContext(source, 2);

            // We use a StringBuilder because we're formatting the lines, and may have formatting tokens that
            // start and end on different lines - that won't work if logging the individual lines.
            var builder = new StringBuilder();

            for (int i = 0; i < context.Lines.Count; i++)
            {
                int    lineNumber = i + context.FirstLine;
                string line       = context.Lines[i];
                if (lineNumber == range.End.Line)
                {
                    line = line[..range.End.Column] + "[/]" + line[range.End.Column..];