public static void CollectBlockSpans(
            Document document,
            SyntaxNode syntaxRoot,
            ImmutableDictionary <Type, ImmutableArray <AbstractSyntaxStructureProvider> > nodeOutlinerMap,
            ImmutableDictionary <int, ImmutableArray <AbstractSyntaxStructureProvider> > triviaOutlinerMap,
            ArrayBuilder <BlockSpan> spans,
            CancellationToken cancellationToken)
        {
            var collector = new BlockSpanCollector(document, nodeOutlinerMap, triviaOutlinerMap, spans, cancellationToken);

            collector.Collect(syntaxRoot);
        }
        private void ProvideBlockStructureWorker(
            BlockStructureContext context, SyntaxNode syntaxRoot)
        {
            var spans = ArrayBuilder <BlockSpan> .GetInstance();

            BlockSpanCollector.CollectBlockSpans(
                context.Document, syntaxRoot, _nodeProviderMap, _triviaProviderMap, spans, context.CancellationToken);

            foreach (var span in spans)
            {
                context.AddBlockSpan(span);
            }

            spans.Free();
        }