Пример #1
0
        public override SyntaxNode Visit(SyntaxNode node)
        {
            _cancellationToken.ThrowIfCancellationRequested();

            if (node == null || !_spans.HasIntervalThatIntersectsWith(node.FullSpan))
            {
                return(node);
            }

            return(base.Visit(node));
        }
Пример #2
0
        private IList <TextChange> CreateTextChanges(CancellationToken cancellationToken)
        {
            using (Logger.LogBlock(FunctionId.Formatting_AggregateCreateTextChanges, cancellationToken))
            {
                // quick check
                var changes = CreateTextChangesWorker(cancellationToken);

                // formatted spans and formatting spans are different, filter returns to formatting span
                return(_formattingSpans == null
                    ? changes
                    : changes.Where(s => _formattingSpans.HasIntervalThatIntersectsWith(s.Span)).ToList());
            }
        }
Пример #3
0
 /// <summary>
 /// check whether the given span is intersects with the tree
 /// </summary>
 public static bool HasIntervalThatIntersectsWith(
     this SimpleIntervalTree <TextSpan, TextSpanIntervalIntrospector> tree,
     TextSpan span
     ) => tree.HasIntervalThatIntersectsWith(span.Start, span.Length);