private void ProvideBlockStructureWorker(
            BlockStructureContext context, SyntaxNode syntaxRoot)
        {
            using var spans = TemporaryArray <BlockSpan> .Empty;
            BlockSpanCollector.CollectBlockSpans(
                syntaxRoot, context.OptionProvider, _nodeProviderMap, _triviaProviderMap, ref spans.AsRef(), context.CancellationToken);

            foreach (var span in spans)
            {
                context.AddBlockSpan(span);
            }
        }
Beispiel #2
0
        private void ProvideBlockStructureWorker(
            BlockStructureContext context, SyntaxNode syntaxRoot)
        {
            var spans = ArrayBuilder <BlockSpan> .GetInstance();

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

            UpdateAndAddSpans(context, spans);

            spans.Free();
        }
        private void ProvideBlockStructureWorker(
            BlockStructureContext context, SyntaxNode syntaxRoot)
        {
            var spans = ImmutableArray.CreateBuilder <BlockSpan>();

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

            foreach (var region in spans)
            {
                context.AddBlockSpan(region);
            }
        }
Beispiel #4
0
        private void ProvideBlockStructureWorker(
            BlockStructureContext context, SyntaxNode syntaxRoot)
        {
            using var _ = ArrayBuilder <BlockSpan> .GetInstance(out var spans);

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

            foreach (var span in spans)
            {
                context.AddBlockSpan(span);
            }
        }
        public override void ProvideBlockStructure(BlockStructureContext context)
        {
            try
            {
                var syntaxRoot = context.SyntaxTree.GetRoot(context.CancellationToken);
                using var spans = TemporaryArray <BlockSpan> .Empty;
                BlockSpanCollector.CollectBlockSpans(
                    syntaxRoot, context.Options, _nodeProviderMap, _triviaProviderMap, ref spans.AsRef(), context.CancellationToken);

                foreach (var span in spans)
                {
                    context.AddBlockSpan(span);
                }
            }
            catch (Exception e) when(FatalError.ReportAndPropagateUnlessCanceled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }