private async Task <IList <TodoComment> > GetTodoCommentsInCurrentProcessAsync(
            Document document, IList <TodoCommentDescriptor> commentDescriptors, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            // strongly hold onto text and tree
            var syntaxDoc = await SyntacticDocument.CreateAsync(document, cancellationToken).ConfigureAwait(false);

            // reuse list
            var todoList = new List <TodoComment>();

            foreach (var trivia in syntaxDoc.Root.DescendantTrivia())
            {
                cancellationToken.ThrowIfCancellationRequested();

                if (!ContainsComments(trivia))
                {
                    continue;
                }

                AppendTodoComments(commentDescriptors, syntaxDoc, trivia, todoList);
            }

            return(todoList);
        }
示例#2
0
        public static async ValueTask <Location> ConvertLocationAsync(
            this DiagnosticDataLocation?dataLocation, Project project, CancellationToken cancellationToken)
        {
            if (dataLocation?.DocumentId == null)
            {
                return(Location.None);
            }

            var textDocument = project.GetTextDocument(dataLocation.DocumentId)
                               ?? await project.GetSourceGeneratedDocumentAsync(dataLocation.DocumentId, cancellationToken).ConfigureAwait(false);

            if (textDocument == null)
            {
                return(Location.None);
            }

            if (textDocument is Document document && document.SupportsSyntaxTree)
            {
                var syntacticDocument = await SyntacticDocument.CreateAsync(document, cancellationToken).ConfigureAwait(false);

                return(dataLocation.ConvertLocation(syntacticDocument));
            }

            return(dataLocation.ConvertLocation());
        }
示例#3
0
        protected override async Task <AbstractIndenter> GetIndenterAsync(
            Document document, TextLine lineToBeIndented, IEnumerable <IFormattingRule> formattingRules, OptionSet optionSet, CancellationToken cancellationToken)
        {
            var syntacticDocument = await SyntacticDocument.CreateAsync(document, cancellationToken).ConfigureAwait(false);

            return(new Indenter(syntacticDocument, formattingRules, optionSet, lineToBeIndented, cancellationToken));
        }
        protected override void AppendTodoComments(ImmutableArray<TodoCommentDescriptor> commentDescriptors, SyntacticDocument document, SyntaxTrivia trivia, List<TodoComment> todoList)
        {
            if (PreprocessorHasComment(trivia))
            {
                var message = trivia.ToFullString();

                var index = message.IndexOf(SingleLineCommentPrefix);
                var start = trivia.FullSpan.Start + index;

                AppendTodoCommentInfoFromSingleLine(commentDescriptors, document, message.Substring(index), start, todoList);
                return;
            }

            if (IsSingleLineComment(trivia))
            {
                ProcessMultilineComment(commentDescriptors, document, trivia, postfixLength: 0, todoList: todoList);
                return;
            }

            if (IsMultilineComment(trivia))
            {
                ProcessMultilineComment(commentDescriptors, document, trivia, s_multilineCommentPostfixLength, todoList);
                return;
            }

            throw ExceptionUtilities.Unreachable;
        }
            public Indenter(
                AbstractIndentationService <TSyntaxRoot> service,
                SyntacticDocument document,
                IEnumerable <AbstractFormattingRule> rules,
                OptionSet optionSet,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                Document = document;

                this._service          = service;
                this._syntaxFacts      = document.Document.GetLanguageService <ISyntaxFactsService>();
                this.OptionSet         = optionSet;
                this.Root              = (TSyntaxRoot)document.Root;
                this.LineToBeIndented  = lineToBeIndented;
                this._tabSize          = this.OptionSet.GetOption(FormattingOptions.TabSize, Root.Language);
                this.CancellationToken = cancellationToken;

                this.Rules  = rules;
                this.Finder = new BottomUpBaseIndentationFinder(
                    new ChainedFormattingRules(this.Rules, OptionSet),
                    this._tabSize,
                    this.OptionSet.GetOption(FormattingOptions.IndentationSize, Root.Language),
                    tokenStream: null);
            }
        protected void AppendTodoCommentInfoFromSingleLine(ImmutableArray<TodoCommentDescriptor> commentDescriptors, SyntacticDocument document, string message, int start, List<TodoComment> todoList)
        {
            var index = GetCommentStartingIndex(message);
            if (index >= message.Length)
            {
                return;
            }

            var normalized = GetNormalizedText(message);
            foreach (var commentDescriptor in commentDescriptors)
            {
                var token = commentDescriptor.Text;
                if (string.Compare(
                        normalized, index, token, indexB: 0,
                        length: token.Length, comparisonType: StringComparison.OrdinalIgnoreCase) != 0)
                {
                    continue;
                }

                if ((message.Length > index + token.Length) && IsIdentifierCharacter(message[index + token.Length]))
                {
                    // they wrote something like:
                    // todoboo
                    // instead of
                    // todo
                    continue;
                }

                todoList.Add(new TodoComment(commentDescriptor, message.Substring(index), start + index));
            }
        }
        protected override void AppendTodoComments(
            ImmutableArray <TodoCommentDescriptor> commentDescriptors,
            SyntacticDocument document, SyntaxTrivia trivia,
            ArrayBuilder <TodoComment> todoList)
        {
            if (PreprocessorHasComment(trivia))
            {
                var message = trivia.ToFullString();

                var index = message.IndexOf(SingleLineCommentPrefix, StringComparison.Ordinal);
                var start = trivia.FullSpan.Start + index;

                AppendTodoCommentInfoFromSingleLine(commentDescriptors, message.Substring(index), start, todoList);
                return;
            }

            if (IsSingleLineComment(trivia))
            {
                ProcessMultilineComment(commentDescriptors, document, trivia, postfixLength: 0, todoList: todoList);
                return;
            }

            if (IsMultilineComment(trivia))
            {
                ProcessMultilineComment(commentDescriptors, document, trivia, s_multilineCommentPostfixLength, todoList);
                return;
            }

            throw ExceptionUtilities.Unreachable;
        }
示例#8
0
        public async Task <ImmutableArray <TodoComment> > GetTodoCommentsAsync(
            Document document,
            ImmutableArray <TodoCommentDescriptor> commentDescriptors,
            CancellationToken cancellationToken)
        {
            if (commentDescriptors.IsEmpty)
            {
                return(ImmutableArray <TodoComment> .Empty);
            }

            cancellationToken.ThrowIfCancellationRequested();

            // strongly hold onto text and tree
            var syntaxDoc = await SyntacticDocument.CreateAsync(document, cancellationToken).ConfigureAwait(false);

            // reuse list
            using var _ = ArrayBuilder <TodoComment> .GetInstance(out var todoList);

            foreach (var trivia in syntaxDoc.Root.DescendantTrivia())
            {
                cancellationToken.ThrowIfCancellationRequested();

                if (!ContainsComments(trivia))
                {
                    continue;
                }

                AppendTodoComments(commentDescriptors, syntaxDoc, trivia, todoList);
            }

            return(todoList.ToImmutable());
        }
        private Indenter GetIndenter(
            Document document,
            int lineNumber,
            FormattingOptions.IndentStyle indentStyle,
            CancellationToken cancellationToken
            )
        {
            var documentOptions = document
                                  .GetOptionsAsync(cancellationToken)
                                  .WaitAndGetResult_CanCallOnBackground(cancellationToken);
            var syntacticDoc = SyntacticDocument
                               .CreateAsync(document, cancellationToken)
                               .WaitAndGetResult_CanCallOnBackground(cancellationToken);

            var sourceText       = syntacticDoc.Root.SyntaxTree.GetText(cancellationToken);
            var lineToBeIndented = sourceText.Lines[lineNumber];

            var formattingRules = GetFormattingRules(document, lineToBeIndented.Start, indentStyle);

            return(new Indenter(
                       this,
                       syntacticDoc,
                       formattingRules,
                       documentOptions,
                       lineToBeIndented,
                       cancellationToken
                       ));
        }
示例#10
0
        public static async Task <Location> ConvertLocationAsync(
            this DiagnosticDataLocation dataLocation, Project project, CancellationToken cancellationToken)
        {
            if (dataLocation?.DocumentId == null)
            {
                return(Location.None);
            }

            var document = project.GetDocument(dataLocation?.DocumentId);

            if (document == null)
            {
                return(Location.None);
            }


            if (document.SupportsSyntaxTree)
            {
                var syntacticDocument = await SyntacticDocument.CreateAsync(document, cancellationToken).ConfigureAwait(false);

                return(dataLocation.ConvertLocation(syntacticDocument));
            }

            return(dataLocation.ConvertLocation());
        }
            public Indenter(
                AbstractIndentationService <TSyntaxRoot> service,
                SyntacticDocument document,
                IEnumerable <AbstractFormattingRule> rules,
                OptionSet optionSet,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                Document = document;

                _service          = service;
                _syntaxFacts      = document.Document.GetRequiredLanguageService <ISyntaxFactsService>();
                OptionSet         = optionSet;
                OptionService     = document.Document.Project.Solution.Workspace.Services.GetRequiredService <IOptionService>();
                Root              = (TSyntaxRoot)document.Root;
                LineToBeIndented  = lineToBeIndented;
                _tabSize          = this.OptionSet.GetOption(FormattingOptions.TabSize, Root.Language);
                CancellationToken = cancellationToken;

                Rules  = rules;
                Finder = new BottomUpBaseIndentationFinder(
                    new ChainedFormattingRules(this.Rules, OptionSet.AsAnalyzerConfigOptions(OptionService, Root.Language)),
                    _tabSize,
                    this.OptionSet.GetOption(FormattingOptions.IndentationSize, Root.Language),
                    tokenStream: null,
                    _syntaxFacts);
            }
示例#12
0
            public Indenter(
                AbstractIndentationService <TSyntaxRoot> service,
                SyntacticDocument document,
                IEnumerable <AbstractFormattingRule> rules,
                IndentationOptions options,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                Document = document;

                _service          = service;
                _syntaxFacts      = document.Document.GetRequiredLanguageService <ISyntaxFactsService>();
                Options           = options;
                Root              = (TSyntaxRoot)document.Root;
                LineToBeIndented  = lineToBeIndented;
                _tabSize          = options.FormattingOptions.TabSize;
                CancellationToken = cancellationToken;

                Rules  = rules;
                Finder = new BottomUpBaseIndentationFinder(
                    new ChainedFormattingRules(this.Rules, options.FormattingOptions),
                    _tabSize,
                    options.FormattingOptions.IndentationSize,
                    tokenStream: null,
                    document.Document.GetRequiredLanguageService <IHeaderFactsService>());
            }
示例#13
0
        public static Location ConvertLocation(
            this DiagnosticDataLocation dataLocation, SyntacticDocument document = null)
        {
            if (dataLocation?.DocumentId == null)
            {
                return(Location.None);
            }

            if (document == null)
            {
                if (dataLocation?.OriginalFilePath == null || dataLocation.SourceSpan == null)
                {
                    return(Location.None);
                }

                var span = dataLocation.SourceSpan.Value;
                return(Location.Create(dataLocation?.OriginalFilePath, span, new LinePositionSpan(
                                           new LinePosition(dataLocation.OriginalStartLine, dataLocation.OriginalStartColumn),
                                           new LinePosition(dataLocation.OriginalEndLine, dataLocation.OriginalEndColumn))));
            }

            Contract.ThrowIfFalse(dataLocation.DocumentId == document.Document.Id);

            var syntaxTree = document.SyntaxTree;

            return(syntaxTree.GetLocation(dataLocation.SourceSpan ?? DiagnosticData.GetTextSpan(dataLocation, document.Text)));
        }
 public Indenter(
     SyntacticDocument document,
     IEnumerable <IFormattingRule> rules,
     OptionSet optionSet,
     TextLine line,
     CancellationToken cancellationToken) :
     base(document, rules, optionSet, line, cancellationToken)
 {
 }
示例#15
0
 public static void CollectOutliningSpans(
     SyntacticDocument document,
     ImmutableDictionary<Type, ImmutableArray<AbstractSyntaxNodeOutliner>> nodeOutlinerMap,
     ImmutableDictionary<int, ImmutableArray<AbstractSyntaxTriviaOutliner>> triviaOutlinerMap,
     List<OutliningSpan> spans,
     CancellationToken cancellationToken)
 {
     var collector = new RegionCollector(document, nodeOutlinerMap, triviaOutlinerMap, spans, cancellationToken);
     collector.Collect(document.Root);
 }
示例#16
0
        public static void CollectOutliningSpans(
            SyntacticDocument document,
            ImmutableDictionary <Type, ImmutableArray <AbstractSyntaxOutliner> > nodeOutlinerMap,
            ImmutableDictionary <int, ImmutableArray <AbstractSyntaxOutliner> > triviaOutlinerMap,
            List <OutliningSpan> spans,
            CancellationToken cancellationToken)
        {
            var collector = new RegionCollector(document, nodeOutlinerMap, triviaOutlinerMap, spans, cancellationToken);

            collector.Collect(document.Root);
        }
示例#17
0
 private RegionCollector(
     SyntacticDocument document,
     ImmutableDictionary<Type, ImmutableArray<AbstractSyntaxNodeOutliner>> nodeOutlinerMap,
     ImmutableDictionary<int, ImmutableArray<AbstractSyntaxTriviaOutliner>> triviaOutlinerMap,
     List<OutliningSpan> spans,
     CancellationToken cancellationToken)
 {
     _document = document;
     _nodeOutlinerMap = nodeOutlinerMap;
     _triviaOutlinerMap = triviaOutlinerMap;
     _regions = spans;
     _cancellationToken = cancellationToken;
 }
示例#18
0
 private RegionCollector(
     SyntacticDocument document,
     ImmutableDictionary <Type, ImmutableArray <AbstractSyntaxOutliner> > nodeOutlinerMap,
     ImmutableDictionary <int, ImmutableArray <AbstractSyntaxOutliner> > triviaOutlinerMap,
     List <OutliningSpan> spans,
     CancellationToken cancellationToken)
 {
     _document          = document;
     _nodeOutlinerMap   = nodeOutlinerMap;
     _triviaOutlinerMap = triviaOutlinerMap;
     _regions           = spans;
     _cancellationToken = cancellationToken;
 }
            public AbstractIndenter(Document document, IEnumerable <IFormattingRule> rules, OptionSet optionSet, ITextSnapshotLine lineToBeIndented, CancellationToken cancellationToken)
            {
                this.OptionSet         = optionSet;
                this.Document          = SyntacticDocument.CreateAsync(document, cancellationToken).WaitAndGetResult(cancellationToken);
                this.LineToBeIndented  = lineToBeIndented;
                this.TabSize           = this.OptionSet.GetOption(FormattingOptions.TabSize, this.Document.Root.Language);
                this.CancellationToken = cancellationToken;

                this.Rules  = rules;
                this.Tree   = this.Document.SyntaxTree;
                this.Finder = new BottomUpBaseIndentationFinder(
                    new ChainedFormattingRules(this.Rules, OptionSet),
                    this.TabSize,
                    this.OptionSet.GetOption(FormattingOptions.IndentationSize, this.Document.Root.Language),
                    tokenStream: null);
            }
            public AbstractIndenter(Document document, IEnumerable<IFormattingRule> rules, OptionSet optionSet, ITextSnapshotLine lineToBeIndented, CancellationToken cancellationToken)
            {
                this.OptionSet = optionSet;
                this.Document = SyntacticDocument.CreateAsync(document, cancellationToken).WaitAndGetResult(cancellationToken);
                this.LineToBeIndented = lineToBeIndented;
                this.TabSize = this.OptionSet.GetOption(FormattingOptions.TabSize, this.Document.Root.Language);
                this.CancellationToken = cancellationToken;

                this.Rules = rules;
                this.Tree = this.Document.SyntaxTree;
                this.Finder = new BottomUpBaseIndentationFinder(
                         new ChainedFormattingRules(this.Rules, OptionSet),
                         this.TabSize,
                         this.OptionSet.GetOption(FormattingOptions.IndentationSize, this.Document.Root.Language),
                         tokenStream: null);
            }
示例#21
0
        protected void ProcessMultilineComment(
            ImmutableArray <TodoCommentDescriptor> commentDescriptors,
            SyntacticDocument document,
            SyntaxTrivia trivia, int postfixLength,
            ArrayBuilder <TodoComment> todoList)
        {
            // this is okay since we know it is already alive
            var text = document.Text;

            var fullSpan   = trivia.FullSpan;
            var fullString = trivia.ToFullString();

            var startLine = text.Lines.GetLineFromPosition(fullSpan.Start);
            var endLine   = text.Lines.GetLineFromPosition(fullSpan.End);

            // single line multiline comments
            if (startLine.LineNumber == endLine.LineNumber)
            {
                var message = postfixLength == 0 ? fullString : fullString.Substring(0, fullSpan.Length - postfixLength);
                AppendTodoCommentInfoFromSingleLine(commentDescriptors, message, fullSpan.Start, todoList);
                return;
            }

            // multiline
            var startMessage = text.ToString(TextSpan.FromBounds(fullSpan.Start, startLine.End));

            AppendTodoCommentInfoFromSingleLine(commentDescriptors, startMessage, fullSpan.Start, todoList);

            for (var lineNumber = startLine.LineNumber + 1; lineNumber < endLine.LineNumber; lineNumber++)
            {
                var line    = text.Lines[lineNumber];
                var message = line.ToString();

                AppendTodoCommentInfoFromSingleLine(commentDescriptors, message, line.Start, todoList);
            }

            var length = fullSpan.End - endLine.Start;

            if (length >= postfixLength)
            {
                length -= postfixLength;
            }

            var endMessage = text.ToString(new TextSpan(endLine.Start, length));

            AppendTodoCommentInfoFromSingleLine(commentDescriptors, endMessage, endLine.Start, todoList);
        }
示例#22
0
        public async Task <IList <OutliningSpan> > GetOutliningSpansAsync(Document document, CancellationToken cancellationToken)
        {
            try
            {
                var syntaxDocument = await SyntacticDocument.CreateAsync(document, cancellationToken).ConfigureAwait(false);

                // change this to shared pool once RI
                var regions = new List <OutliningSpan>();
                RegionCollector.CollectOutliningSpans(syntaxDocument, _nodeOutlinerMap, _triviaOutlinerMap, regions, cancellationToken);

                return(regions);
            }
            catch (Exception e) when(FatalError.ReportUnlessCanceled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
        protected void ProcessMultilineComment(ImmutableArray<TodoCommentDescriptor> commentDescriptors, SyntacticDocument document, SyntaxTrivia trivia, int postfixLength, List<TodoComment> todoList)
        {
            // this is okay since we know it is already alive
            var text = document.Text;

            var fullSpan = trivia.FullSpan;
            var fullString = trivia.ToFullString();

            var startLine = text.Lines.GetLineFromPosition(fullSpan.Start);
            var endLine = text.Lines.GetLineFromPosition(fullSpan.End);

            // single line multiline comments
            if (startLine.LineNumber == endLine.LineNumber)
            {
                var message = postfixLength == 0 ? fullString : fullString.Substring(0, fullSpan.Length - postfixLength);
                AppendTodoCommentInfoFromSingleLine(commentDescriptors, document, message, fullSpan.Start, todoList);
                return;
            }

            // multiline 
            var startMessage = text.ToString(TextSpan.FromBounds(fullSpan.Start, startLine.End));
            AppendTodoCommentInfoFromSingleLine(commentDescriptors, document, startMessage, fullSpan.Start, todoList);

            for (var lineNumber = startLine.LineNumber + 1; lineNumber < endLine.LineNumber; lineNumber++)
            {
                var line = text.Lines[lineNumber];
                var message = line.ToString();

                AppendTodoCommentInfoFromSingleLine(commentDescriptors, document, message, line.Start, todoList);
            }

            var length = fullSpan.End - endLine.Start;
            if (length >= postfixLength)
            {
                length -= postfixLength;
            }

            var endMessage = text.ToString(new TextSpan(endLine.Start, length));
            AppendTodoCommentInfoFromSingleLine(commentDescriptors, document, endMessage, endLine.Start, todoList);
        }
示例#24
0
            public AbstractIndenter(
                SyntacticDocument document,
                IEnumerable <IFormattingRule> rules,
                OptionSet optionSet,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                this.OptionSet         = optionSet;
                this.Document          = document;
                this.LineToBeIndented  = lineToBeIndented;
                this.TabSize           = this.OptionSet.GetOption(FormattingOptions.TabSize, this.Document.Root.Language);
                this.CancellationToken = cancellationToken;

                this.Rules  = rules;
                this.Tree   = this.Document.SyntaxTree;
                this.Finder = new BottomUpBaseIndentationFinder(
                    new ChainedFormattingRules(this.Rules, OptionSet),
                    this.TabSize,
                    this.OptionSet.GetOption(FormattingOptions.IndentationSize, this.Document.Root.Language),
                    tokenStream: null,
                    lastToken: default(SyntaxToken));
            }
            public AbstractIndenter(
                SyntacticDocument document,
                IEnumerable<IFormattingRule> rules,
                OptionSet optionSet,
                TextLine lineToBeIndented,
                CancellationToken cancellationToken)
            {
                this.OptionSet = optionSet;
                this.Document = document;
                this.LineToBeIndented = lineToBeIndented;
                this.TabSize = this.OptionSet.GetOption(FormattingOptions.TabSize, this.Document.Root.Language);
                this.CancellationToken = cancellationToken;

                this.Rules = rules;
                this.Tree = this.Document.SyntaxTree;
                this.Finder = new BottomUpBaseIndentationFinder(
                         new ChainedFormattingRules(this.Rules, OptionSet),
                         this.TabSize,
                         this.OptionSet.GetOption(FormattingOptions.IndentationSize, this.Document.Root.Language),
                         tokenStream: null,
                         lastToken: default(SyntaxToken));
            }
 protected abstract void AppendTodoComments(IList <TodoCommentDescriptor> commentDescriptors, SyntacticDocument document, SyntaxTrivia trivia, List <TodoComment> todoList);
        protected void AppendTodoCommentInfoFromSingleLine(IList <TodoCommentDescriptor> commentDescriptors, SyntacticDocument document, string message, int start, List <TodoComment> todoList)
        {
            var index = GetCommentStartingIndex(message);

            if (index >= message.Length)
            {
                return;
            }

            var normalized = GetNormalizedText(message);

            foreach (var commentDescriptor in commentDescriptors)
            {
                var token = commentDescriptor.Text;
                if (string.Compare(
                        normalized, index, token, indexB: 0,
                        length: token.Length, comparisonType: StringComparison.OrdinalIgnoreCase) != 0)
                {
                    continue;
                }

                if ((message.Length > index + token.Length) && IsIdentifierCharacter(message[index + token.Length]))
                {
                    // they wrote something like:
                    // todoboo
                    // instead of
                    // todo
                    continue;
                }

                todoList.Add(new TodoComment(commentDescriptor, message.Substring(index), start + index));
            }
        }
 protected abstract AbstractIndenter GetIndenter(
     SyntacticDocument document, TextLine lineToBeIndented, IEnumerable <AbstractFormattingRule> formattingRules, OptionSet optionSet, CancellationToken cancellationToken);
示例#29
0
 protected abstract void AppendTodoComments(ImmutableArray <TodoCommentDescriptor> commentDescriptors, SyntacticDocument document, SyntaxTrivia trivia, ArrayBuilder <TodoComment> todoList);
 protected abstract void AppendTodoComments(ImmutableArray<TodoCommentDescriptor> commentDescriptors, SyntacticDocument document, SyntaxTrivia trivia, List<TodoComment> todoList);
示例#31
0
        public static Location ConvertLocation(
            this DiagnosticDataLocation dataLocation, SyntacticDocument document = null)
        {
            if (dataLocation?.DocumentId == null)
            {
                return Location.None;
            }

            if (document == null)
            {
                if (dataLocation?.OriginalFilePath == null || dataLocation.SourceSpan == null)
                {
                    return Location.None;
                }

                var span = dataLocation.SourceSpan.Value;
                return Location.Create(dataLocation?.OriginalFilePath, span, new LinePositionSpan(
                    new LinePosition(dataLocation.OriginalStartLine, dataLocation.OriginalStartColumn),
                    new LinePosition(dataLocation.OriginalEndLine, dataLocation.OriginalEndColumn)));
            }

            Contract.ThrowIfFalse(dataLocation.DocumentId == document.Document.Id);

            var syntaxTree = document.SyntaxTree;
            return syntaxTree.GetLocation(dataLocation.SourceSpan ?? DiagnosticData.GetTextSpan(dataLocation, document.Text));
        }